PCv5/account/forms.py

18 lines
1.2 KiB
Python
Raw Normal View History

2016-10-02 17:07:47 +02:00
#-*- coding: utf-8 -*-
from django.conf import settings
from django import forms
class LoginForm(forms.Form):
2017-04-01 20:20:01 +02:00
# no need for max_length, let's not make heavyer things that can be lighter
2017-04-03 01:21:34 +02:00
username = forms.CharField(label="", widget=forms.TextInput(attrs={'placeholder':'Identifiant'}))
password = forms.CharField(label="", widget=forms.PasswordInput(attrs={'placeholder':'Mot de passe'}))
2017-04-01 20:20:01 +02:00
class InscriptionForm(forms.Form):
username = forms.CharField(label="Nom d'utilisateur", min_length=settings.USERNAME_MIN_LENGTH, max_length=settings.USERNAME_MAX_LENGTH)
email = forms.EmailField(label="E-mail")
# Should we silently truncate password or fix maximum length ? Here is a good answer :
# https://security.stackexchange.com/questions/152430/what-maximum-password-length-to-choose-when-using-bcrypt
password1 = forms.CharField(label="Mot de passe", min_length=settings.PASSWORD_MIN_LENGTH, max_length=settings.PASSWORD_MAX_LENGTH, widget=forms.PasswordInput)
password2 = forms.CharField(label="Confirmer mot de passe", min_length=settings.PASSWORD_MIN_LENGTH, max_length=settings.PASSWORD_MAX_LENGTH, widget=forms.PasswordInput)
cgu = forms.BooleanField(label="J'ai lu et j'accepte les conditions générales d'utilisations", initial=False)