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 @@ -
- {% csrf_token %} - {{ form }} - -
+{% load static %} + + + + + + + + +
+

S'inscrire

+
+
+ {% csrf_token %} + {{ form }} + +
+
+
+ diff --git a/templates/login.html b/templates/login.html deleted file mode 100644 index a9be995..0000000 --- a/templates/login.html +++ /dev/null @@ -1,19 +0,0 @@ -{% load static %} - - - - - - - - -
-

Se connecter

-
- - - -
-
- - diff --git a/templates/register.html b/templates/register.html deleted file mode 100644 index 54346a1..0000000 --- a/templates/register.html +++ /dev/null @@ -1,24 +0,0 @@ -{% load static %} - - - - - - - - -
-

S'inscrire

-
-
- - -
- - - - -
-
- - diff --git a/templates/registration/login.html b/templates/registration/login.html index 73fd22d..e9aa140 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -1,37 +1,36 @@ -{% block content %} +{% load static %} - {% if form.errors %} -

Your username and password didn't match. Please try again.

- {% endif %} + + + + + + +
{% if next %} {% if user.is_authenticated %} -

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 %} -
- {% csrf_token %} - - - - - - - - - -
{{ form.username.label_tag }}{{ form.username }}
{{ form.password.label_tag }}{{ form.password }}
- - -
+

Se connecter

+ {% if form.errors %} +

Votre nom d'utilisateur et votre mot de passe ne correspondent pas. Veuillez réessayer.

+ {% endif %} +
+
+ {% csrf_token %} + + + + +
+
- {# Assumes you setup the password_reset view in your URLconf #}

Lost password?

Register

- -{% endblock %} +