From 48bb0b0e371e0ebf63cd2d35a94eb1f476fcec35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Cantu=C3=A1ria?= Date: Wed, 27 Feb 2019 14:26:02 -0300 Subject: [PATCH] Fix #2556 (#2563) --- sapl/base/forms.py | 51 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 0c8bab476..96b039d3d 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -64,19 +64,46 @@ def get_roles(): class UsuarioCreateForm(ModelForm): logger = logging.getLogger(__name__) - username = forms.CharField(required=True, label="Nome de usuário", - max_length=30) - firstname = forms.CharField(required=True, label="Nome", max_length=30) - lastname = forms.CharField(required=True, label="Sobrenome", max_length=30) - password1 = forms.CharField(required=True, widget=forms.PasswordInput, - label='Senha', max_length=128) - password2 = forms.CharField(required=True, widget=forms.PasswordInput, - label='Confirmar senha', max_length=128) - user_active = forms.ChoiceField(required=False, choices=YES_NO_CHOICES, - label="Usuário ativo?", initial='True') - + username = forms.CharField( + required=True, + label="Nome de usuário", + max_length=30 + ) + firstname = forms.CharField( + required=True, + label="Nome", + max_length=30 + ) + lastname = forms.CharField( + required=True, + label="Sobrenome", + max_length=30 + ) + password1 = forms.CharField( + required=True, + widget=forms.PasswordInput, + label='Senha', + min_length=6, + max_length=128 + ) + password2 = forms.CharField( + required=True, + widget=forms.PasswordInput, + label='Confirmar senha', + min_length=6, + max_length=128 + ) + user_active = forms.ChoiceField( + required=True, + choices=YES_NO_CHOICES, + label="Usuário ativo?", + initial='True' + ) roles = forms.MultipleChoiceField( - required=True, widget=forms.CheckboxSelectMultiple(), choices=get_roles) + required=True, + widget=forms.CheckboxSelectMultiple(), + choices=get_roles + ) class Meta: model = get_user_model()