forked from 0x2620/pandora
signup: fix error documentation, require email
email is required by the UI, and if you don't provide it this method raises KeyError anyway.
This commit is contained in:
parent
51c3df9660
commit
c2e7ac3190
1 changed files with 5 additions and 4 deletions
|
@ -146,16 +146,17 @@ def signup(request, data):
|
||||||
returns {
|
returns {
|
||||||
errors: {
|
errors: {
|
||||||
username: 'Username already exists', // in case of error
|
username: 'Username already exists', // in case of error
|
||||||
password: 'E-mail address already exists' // in case of error
|
email: 'E-mail address already exists', // in case of error
|
||||||
|
password: 'Password can not be empty' // in case of error
|
||||||
}
|
}
|
||||||
user: object // user data, in case of success
|
user: object // user data, in case of success
|
||||||
}
|
}
|
||||||
see: signin, signout
|
see: signin, signout
|
||||||
'''
|
'''
|
||||||
if 'username' in data and 'password' in data:
|
if 'username' in data and 'password' in data and 'email' in data:
|
||||||
data['username'] = data['username'].strip()
|
data['username'] = data['username'].strip()
|
||||||
if 'email' in data:
|
data['email'] = ox.escape_html(data['email'])
|
||||||
data['email'] = ox.escape_html(data['email'])
|
|
||||||
if User.objects.filter(username__iexact=data['username']).count() > 0:
|
if User.objects.filter(username__iexact=data['username']).count() > 0:
|
||||||
response = json_response({
|
response = json_response({
|
||||||
'errors': {
|
'errors': {
|
||||||
|
|
Loading…
Reference in a new issue