From c2e7ac3190256c81f02d4774f8d332a7ea54ca14 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Tue, 28 Apr 2015 18:13:25 +0200 Subject: [PATCH] signup: fix error documentation, require email email is required by the UI, and if you don't provide it this method raises KeyError anyway. --- pandora/user/views.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pandora/user/views.py b/pandora/user/views.py index 4acf06cec..eb9ab625b 100644 --- a/pandora/user/views.py +++ b/pandora/user/views.py @@ -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': {