switched a bit of logic around, reduce the amount of ldap queries
This commit is contained in:
parent
d98b85391d
commit
b5b208b7da
1 changed files with 3 additions and 3 deletions
|
@ -59,12 +59,12 @@ class Register(View):
|
|||
if username == "" or not username:
|
||||
return render(request, 'error.html', { 'urlname': urlname, 'service': service, 'error': 'Please supply a username.' } )
|
||||
# Check to see if username is already taken
|
||||
if check_user_exists(username):
|
||||
return render(request, 'error.html', { 'urlname': urlname, 'service': service, 'error': 'User already exists.' } )
|
||||
# isalnum() may be a bit harsh, but is the most logical choice to make sure it's a username we
|
||||
# can use
|
||||
elif not username.isalnum():
|
||||
if not username.isalnum():
|
||||
return render(request, 'error.html', { 'urlname': urlname, 'service': service, 'error': 'Username has to be alphanumeric.' } )
|
||||
elif check_user_exists(username):
|
||||
return render(request, 'error.html', { 'urlname': urlname, 'service': service, 'error': 'User already exists.' } )
|
||||
password1 = request.POST.get('password1')
|
||||
password2 = request.POST.get('password2')
|
||||
# check if the supplied passwords match
|
||||
|
|
Loading…
Reference in a new issue