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:
Will Thompson 2015-04-28 18:13:25 +02:00 committed by j
parent 51c3df9660
commit c2e7ac3190

View file

@ -146,16 +146,17 @@ def signup(request, data):
returns {
errors: {
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
}
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()
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:
response = json_response({
'errors': {