def validate_token(self, token): token = User.token_model.query(User.token_model.token == token).get() user = None if token: user = User.get_by_id(int(token.user)) return user
def delete_token(self, token, subject=None): token = User.token_model.query(User.token_model.token == token).get() user = User.get_by_id(int(token.user)) token.key.delete() if subject == 'reset': user.resetpassword_token = None user.put() return None