fix(oauth): convert email to lowercase

All user emails are stored as lowercase, but OAuth provider could have it in mixed case.
We pass the email as-is to LoginManager, which could result in a session with an incorrect email.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2025-12-23 18:14:15 +05:30
parent 48c8ee9a78
commit 6204ff351c
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -213,7 +213,9 @@ def login_oauth_user(
frappe.respond_as_web_page(_("Invalid Request"), _("Token is missing"), http_status_code=417)
return
user = get_email(data)
# All user emails are stored as lowercase, but OAuth provider could have it in mixed case.
# We pass the email as-is to LoginManager, which could result in a session with an incorrect email.
user = get_email(data).lower()
if not user:
frappe.respond_as_web_page(