Merge pull request #38983 from AarDG10/fix-auth

fix(auth): return auth. error in case query fails
This commit is contained in:
Aarol D'Souza 2026-04-29 19:51:30 +05:30 committed by GitHub
commit 7c93554b00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -726,9 +726,13 @@ def validate_api_key_secret(api_key, api_secret, frappe_authorization_source=Non
raise frappe.AuthenticationError
doctype = frappe_authorization_source or "User"
docname = frappe.db.get_value(
doctype=doctype, filters={"api_key": api_key, "enabled": True}, fieldname=["name"]
)
try:
docname = frappe.db.get_value(
doctype=doctype, filters={"api_key": api_key, "enabled": True}, fieldname=["name"]
)
except Exception:
raise frappe.AuthenticationError
if not docname:
raise frappe.AuthenticationError
form_dict = frappe.local.form_dict