mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Move Allow Empty Password Appsettings to settings.py file
This commit is contained in:
parent
be0b0330e7
commit
713d565a2d
3 changed files with 25 additions and 26 deletions
|
|
@ -2,16 +2,16 @@ import re
|
|||
from django import forms
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.auth.models import User
|
||||
from appsettings.models import AppSettings
|
||||
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=False if AppSettings.objects.get(key="ALLOW_EMPTY_PASSWORD").value == 'True' else True,
|
||||
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']
|
||||
have_symbol = re.match('^[a-z0-9]+$', name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue