From 491bdf31df8911e175b1361d400c383202f1aa9a Mon Sep 17 00:00:00 2001 From: slice Date: Sat, 21 Jul 2018 09:35:35 -0700 Subject: [PATCH] fix incorrect http status code for auth routes --- litecord/blueprints/auth.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/litecord/blueprints/auth.py b/litecord/blueprints/auth.py index 3bcc073..f46703d 100644 --- a/litecord/blueprints/auth.py +++ b/litecord/blueprints/auth.py @@ -44,7 +44,6 @@ def make_token(user_id, user_pwd_hash) -> str: @bp.route('/register', methods=['POST']) async def register(): - """Register a user on litecord""" j = await request.get_json() email, password, username = j['email'], j['password'], j['username'] @@ -68,7 +67,6 @@ async def register(): @bp.route('/login', methods=['POST']) async def login(): - """Login one user into Litecord.""" j = await request.get_json() email, password = j['email'], j['password'] @@ -79,12 +77,12 @@ async def login(): """, email) if not row: - return jsonify({'email': ['User not found.']}) + return jsonify({'email': ['User not found.']}), 401 user_id, pwd_hash = row if not await check_password(pwd_hash, password): - return jsonify({'password': ['Password does not match.']}) + return jsonify({'password': ['Password does not match.']}), 401 return jsonify({ 'token': make_token(user_id, pwd_hash)