def user_login(**kwargs): username = kwargs.get('username') password = kwargs.get('password') user = User.get_by_username(username) if password != user.password: raise PoseidonError('Error Password') return token_manager.create_token(user.id)
def create_user(**kwargs): username = kwargs.get('username') if User.get_by_username(username): raise PoseidonError('Duplicate Username') new_user = User.new(**kwargs) return serialize_model(new_user)