<% from slowfoot import binderytools from slowfoot.account import createAccount,AccountException f = asform(input) users = xml.users passwdFile = req.get_options()['usersfile'] error = '' newusername = str(f.username) if newusername: if f.password1 != f.password2: error = 'Passwords do not match' elif not (newusername[0].isalpha() and newusername.replace('_','').isalnum()): error = 'Invalid username, only user alphanumeric characters' else: try: user = createAccount(newusername, str(f.password1), passwdFile) newuser = getattr(binderytools.bind_string("<%s>%s"%(newusername,f.domain,newusername)),newusername) users.xml_append(newuser) target(filepath('users.xml')) %><%=xml.xml()%><% except AccountException, e: error = str(e) else: error = 'No username given.' redirect('/page/domains/show?' + urlencode({'error':error})) %>