1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

settings.ALLOW_EMPTY_PASSWORD added. allows to create user withnout password. useful with SSO authentication.

This commit is contained in:
Ing. Jan KRCMAR 2016-06-02 13:39:18 +02:00
parent f484598414
commit 3666ff0738
4 changed files with 6 additions and 3 deletions

View file

@ -2,13 +2,14 @@ import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.conf import settings
class UserAddForm(forms.Form):
name = forms.CharField(label="Name",
error_messages={'required': _('No User name has been entered')},
max_length=20)
password = forms.CharField(required=True, error_messages={'required': _('No password has been entered')},)
password = forms.CharField(required=not settings.ALLOW_EMPTY_PASSWORD, error_messages={'required': _('No password has been entered')},)
def clean_name(self):
name = self.cleaned_data['name']