Example #1
0
 def post(self):
     if not self.validate_xsrf_token():
         return self.redirect_for(self.route_args.route_name)
     credential = Credential()
     if (not self.try_update_model(credential)
             & self.try_update_model(self.model)
             or not self.validate(credential, credential_validator)
             or not self.authenticate(credential)):
         if self.request.ajax:
             return self.json_response({'errors': self.errors})
         credential.password = u('')
         return self.get(credential)
     del self.xsrf_token
     return self.see_other_for('default')
Example #2
0
def next_credential():
    c = Credential()
    c.username = next_name()
    c.password = '******'
    return c