Esempio n. 1
0
 def retrieve(self):
     credentials = credentials_parser.parse_args()  # @UndefinedVariable
     user = User.get(credentials['username'])
     if not user: return {"detail": "Not found"}, 404
     if not user.check_password(credentials['password']): return {"detail": "Forbidden"}, 403
     token = Token(user)
     token.save()
     return marshal(token, token_fields)
Esempio n. 2
0
 def retrieve(self):
     credentials = credentials_parser.parse_args()  # @UndefinedVariable
     user = User.get(credentials['username'])
     if not user: return {"detail": "Not found"}, 404
     if not user.check_password(credentials['password']):
         return {"detail": "Forbidden"}, 403
     token = Token(user)
     token.save()
     return marshal(token, token_fields)
Esempio n. 3
0
 def run(self, username):
     u = User.get(username)
     if u:
         u.delete()
     else:
         print "User with given username not found"
Esempio n. 4
0
 def run(self, username, password, is_admin=False):
     if User.get(username):
         print "User with given username already exists"
     else:
         user = User(username, password)
         user.save()