Skip to content

Commit

Permalink
Ensure email is given on login
Browse files Browse the repository at this point in the history
  • Loading branch information
acasajus committed Oct 9, 2024
1 parent 48dce3a commit 0bb8d89
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/api/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ def auth_login():
password = data.get("password")
device = data.get("device")

email = sanitize_email(data.get("email"))
canonical_email = canonicalize_email(data.get("email"))
email = data.get("email")
if not email:
LoginEvent(LoginEvent.ActionType.failed, LoginEvent.Source.api).send()
return jsonify(error="Email or password incorrect"), 400
email = sanitize_email(email)
canonical_email = canonicalize_email(email)

user = User.get_by(email=email) or User.get_by(email=canonical_email)

Expand Down

0 comments on commit 0bb8d89

Please sign in to comment.