Beispiel #1
0
def auth(req, realm, name, password):
    """Authenticates the given credentials"""
    if realm != REALM:
        return False
        
    db = req.application.settings['db']
    return model.auth_account(db, name, password)
Beispiel #2
0
 def delete(self, path):
     if path.startswith('/controller/accounts/'):
         name = path[21:]
         password = self.get_argument('password')
         
         if not model.auth_account(self.db, name, password):
             raise web.HTTPError(403, 'incorrect username / password combination')
         elif not model.delete_account(self.db, name):
             raise web.HTTPError(404, 'could not find account')
             
     else:
         raise web.HTTPError(404, 'not found')