Integration of kybo branch

This commit is contained in:
Ethanell 2021-12-03 03:34:02 +01:00
parent e5016b1bfc
commit d587904138
6 changed files with 64 additions and 73 deletions

12
nuitdelinfo_2021/forms.py Normal file
View file

@ -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"}),
}

View file

@ -15,14 +15,22 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path, include from django.urls import path, include
from django_registration.views import RegistrationView
from nuitdelinfo_2021 import views from nuitdelinfo_2021 import views
from nuitdelinfo_2021.forms import MyCustomUserForm
urlpatterns = [ urlpatterns = [
path('', views.index, name="index"), path('', views.index, name="index"),
path("a/", include("rescue.urls")), path("a/", include("rescue.urls")),
path("p/", include("people.urls")), path("p/", include("people.urls")),
path('admin/', admin.site.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_registration.backends.activation.urls')),
path('accounts/', include('django.contrib.auth.urls')) path('accounts/', include('django.contrib.auth.urls'))
] ]

View file

@ -1,5 +1,20 @@
{% load static %}
<head>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="{% static 'js/script.js' %}"></script>
</head>
<body>
<section>
<h1 class="regilog-title">S'inscrire</h1>
<div class="regilog-form">
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form }}
<input type="submit" value="login" /> <input type="submit" value="Inscription">
</form> </form>
</div>
</section>
</body>

View file

@ -1,19 +0,0 @@
{% load static %}
<head>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="{% static 'js/script.js' %}"></script>
</head>
<body>
<section>
<h1 class="regilog-title">Se connecter</h1>
<div class="regilog-form">
<input type="text" placeholder="Nom d'utilisateur">
<input type="password" placeholder="Mot de passe">
<input type="submit" value="Connexion">
</div>
</section>
</body>

View file

@ -1,24 +0,0 @@
{% load static %}
<head>
<link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="{% static 'js/script.js' %}"></script>
</head>
<body>
<section>
<h1 class="regilog-title">S'inscrire</h1>
<div class="regilog-form">
<div class="flexgroup">
<input type="text" placeholder="Prénom">
<input type="text" placeholder="Nom">
</div>
<input type="text" placeholder="Nom d'utilisateur">
<input type="email" placeholder="Email">
<input type="password" placeholder="Mot de passe">
<input type="submit" value="Inscription">
</div>
</section>
</body>

View file

@ -1,37 +1,36 @@
{% block content %} {% load static %}
{% if form.errors %} <head>
<p>Your username and password didn't match. Please try again.</p> <link rel="stylesheet" type="text/css" href="{% static 'css/style.css' %}">
{% endif %} <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="{% static 'js/script.js' %}"></script>
</head>
<body>
<section>
{% if next %} {% if next %}
{% if user.is_authenticated %} {% if user.is_authenticated %}
<p>Your account doesn't have access to this page. To proceed, <p>Votre compte n'a pas accès à cette page. Pour continuer, veuillez vous connecter avec un compte qui a accès.</p>
please login with an account that has access.</p>
{% else %} {% else %}
<p>Please login to see this page.</p> <p>Veuillez vous connecter pour voir cette page.</p>
{% endif %} {% endif %}
{% endif %} {% endif %}
<h1 class="regilog-title">Se connecter</h1>
{% if form.errors %}
<p>Votre nom d'utilisateur et votre mot de passe ne correspondent pas. Veuillez réessayer.</p>
{% endif %}
<div class="regilog-form">
<form method="post" action="{% url 'login' %}"> <form method="post" action="{% url 'login' %}">
{% csrf_token %} {% csrf_token %}
<table> <input type="text" name="username" placeholder="Nom d'utilisateur">
<tr> <input type="password" name="password" placeholder="Mot de passe">
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" /> <input type="hidden" name="next" value="{{ next }}" />
<input type="submit" value="Connexion">
</form> </form>
</div>
{# Assumes you setup the password_reset view in your URLconf #}
<p><a href="{% url 'password_reset' %}">Lost password?</a></p> <p><a href="{% url 'password_reset' %}">Lost password?</a></p>
<p><a href="{% url 'django_registration_register' %}">Register</a></p> <p><a href="{% url 'django_registration_register' %}">Register</a></p>
</section>
{% endblock %}