Skip to content

Commit 3da16a4

Browse files
committed
fix: normalize email input in login function and update profile retrieval method
1 parent 40f579f commit 3da16a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/api/views/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def newregister():
159159
@auth.route("/login", methods=["POST"])
160160
def login():
161161
data = request.json
162-
email = data.get("email")
162+
email = (data.get("email") or "").strip().lower()
163163
password = data.get("password")
164164
role = int(data.get("role"))
165165
path = data.get("path", None)
@@ -170,7 +170,7 @@ def login():
170170
if not profile_model.objects(email=email):
171171
profile_model = get_profile_model(Account.PARTNER)
172172

173-
profile = profile_model.objects.get(email=email)
173+
profile = profile_model.objects(email=email).first()
174174

175175
try:
176176
firebase_user = firebase_client.auth().sign_in_with_email_and_password(

0 commit comments

Comments
 (0)