mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
settings.ALLOW_EMPTY_PASSWORD added. allows to create user withnout password. useful with SSO authentication.
This commit is contained in:
parent
f484598414
commit
3666ff0738
4 changed files with 6 additions and 3 deletions
|
@ -2,13 +2,14 @@ import re
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
class UserAddForm(forms.Form):
|
class UserAddForm(forms.Form):
|
||||||
name = forms.CharField(label="Name",
|
name = forms.CharField(label="Name",
|
||||||
error_messages={'required': _('No User name has been entered')},
|
error_messages={'required': _('No User name has been entered')},
|
||||||
max_length=20)
|
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):
|
def clean_name(self):
|
||||||
name = self.cleaned_data['name']
|
name = self.cleaned_data['name']
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">{% trans "Password" %}</label>
|
<label class="col-sm-4 control-label">{% trans "Password" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input type="password" class="form-control" name="password" placeholder="*******" required>
|
<input type="password" class="form-control" name="password" placeholder="*******" {% if not allow_empty_password %}required{% endif %}>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -85,6 +85,7 @@ def accounts(request):
|
||||||
error_messages = []
|
error_messages = []
|
||||||
users = User.objects.all().order_by('username')
|
users = User.objects.all().order_by('username')
|
||||||
create_missing_userattributes(users)
|
create_missing_userattributes(users)
|
||||||
|
allow_empty_password = settings.ALLOW_EMPTY_PASSWORD
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
if 'create' in request.POST:
|
if 'create' in request.POST:
|
||||||
|
|
|
@ -116,3 +116,4 @@ ALLOW_INSTANCE_MULTIPLE_OWNER = True
|
||||||
CLONE_INSTANCE_DEFAULT_PREFIX = 'ourea'
|
CLONE_INSTANCE_DEFAULT_PREFIX = 'ourea'
|
||||||
LOGS_PER_PAGE = 100
|
LOGS_PER_PAGE = 100
|
||||||
QUOTA_DEBUG = True
|
QUOTA_DEBUG = True
|
||||||
|
ALLOW_EMPTY_PASSWORD = True
|
||||||
|
|
Loading…
Reference in a new issue