Ejemplo n.º 1
0
 def register(self):
     token = Validations.encode_hash(self.user.get('password'))
     user = User()
     user.username = self.user.get('username')
     user.email = self.user.get('email')
     user.password = token
     resp = user.save()
     if resp.get('status'):
         return {"status": "user registered", "token": token}
     return resp.get('msg')
Ejemplo n.º 2
0
 def login(self):
     user = self.user.get('email')
     token = Validations.encode_hash(self.user.get('password'))
     user = Validations.validate_user_authorization(token, user=user)
     return {"status": "Successful login!", "token": token}