diff options
Diffstat (limited to 'index.py')
-rwxr-xr-x | index.py | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -81,11 +81,7 @@ class SubdapSite(object): # details.append([k, value]) ## x += '<tr><td>%s</td><td><pre>%s</pre></td></tr>\n' % (k, "<hr>".join(v)) - @expose('create.html') - def create(s): - return render(errors = {}, username = '') - @expose('create.html') - def docreate(s, username = None, password = None, password2 = None): + def params_validate(s, errors, username, password, password2): errors = {} if username == None or username == '': errors['username'] = 'please specify an user name' @@ -96,6 +92,16 @@ class SubdapSite(object): if password2 != password: errors['password2'] = 'passwords did not match' if len(errors) > 0: + return errors + return None + + @expose('create.html') + def create(s, username = None, password = None, password2 = None): + if cherrypy.request.method.upper() == 'GET': + return render(errors = {}, username = '') + + errors = s.params_validate(errors, username, password, password2) + if errors is not None: return render(errors = errors, username = username) accountservice.name_create(username, password) |