diff --git a/nuitdelinfo_2021/forms.py b/nuitdelinfo_2021/forms.py new file mode 100644 index 0000000..0275344 --- /dev/null +++ b/nuitdelinfo_2021/forms.py @@ -0,0 +1,12 @@ +from django.forms import TextInput, PasswordInput +from django_registration.forms import RegistrationForm + + +class MyCustomUserForm(RegistrationForm): + class Meta(RegistrationForm.Meta): + widgets = { + "username": TextInput(attrs={'placeholder': "Nom d'utilisateur"}), + "email": TextInput(attrs={'placeholder': "Email"}), + "password1": PasswordInput(attrs={'placeholder': "Mot de passe"}), + "password2": PasswordInput(attrs={'placeholder': "Confirmation du mot de passe"}), + } diff --git a/nuitdelinfo_2021/urls.py b/nuitdelinfo_2021/urls.py index 6286e2e..01253c1 100644 --- a/nuitdelinfo_2021/urls.py +++ b/nuitdelinfo_2021/urls.py @@ -15,14 +15,22 @@ Including another URLconf """ from django.contrib import admin from django.urls import path, include +from django_registration.views import RegistrationView from nuitdelinfo_2021 import views +from nuitdelinfo_2021.forms import MyCustomUserForm urlpatterns = [ path('', views.index, name="index"), path("a/", include("rescue.urls")), path("p/", include("people.urls")), path('admin/', admin.site.urls), + path('accounts/register/', + RegistrationView.as_view( + form_class=MyCustomUserForm + ), + name='django_registration_register', + ), path('accounts/', include('django_registration.backends.activation.urls')), path('accounts/', include('django.contrib.auth.urls')) ] diff --git a/templates/django_registration/registration_form.html b/templates/django_registration/registration_form.html index 19e304b..6826858 100644 --- a/templates/django_registration/registration_form.html +++ b/templates/django_registration/registration_form.html @@ -1,5 +1,20 @@ -
+{% load static %} + + + + + + + + +Your username and password didn't match. Please try again.
- {% endif %} + + + + + + +Your account doesn't have access to this page. To proceed, - please login with an account that has access.
+Votre compte n'a pas accès à cette page. Pour continuer, veuillez vous connecter avec un compte qui a accès.
{% else %} -Please login to see this page.
+Veuillez vous connecter pour voir cette page.
{% endif %} {% endif %} - +Votre nom d'utilisateur et votre mot de passe ne correspondent pas. Veuillez réessayer.
+ {% endif %} +