Commit 40f5b177 authored by Ahmad Anvari's avatar Ahmad Anvari

add balance to user signup

parent de3ea93c
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment