diff --git a/routes/auth.py b/routes/auth.py index 3cf394aea34a36fce84152b6aa63736c6e8201be..e004f41a2104381bd50278161f96e5d17d72e1b8 100644 --- a/routes/auth.py +++ b/routes/auth.py @@ -22,7 +22,8 @@ def signup(): first_name=body["first_name"], last_name=body["last_name"], email=body["email"], - hashed_password=hashed_password) + hashed_password=hashed_password, + balance=5000000000) u.store() return jsonify({"token": generate_jwt(u.get_id()), "type": "Bearer"}) @@ -33,6 +34,8 @@ def login(): email = body["email"] password = body["password"] u = User.find_by_username(email=email) + if u is None: + jsonify({"Error": "Email or password is not matched"}), 401 if u.compare_password(password): return jsonify({"token": generate_jwt(u.get_id()), "type": "Bearer"}) return jsonify({"Error": "Email or password is not matched"}), 401