fix(auth): return auth. error in case query fails

Previously was running query and throwing trace on failure, we should be raising an Auth. error if failure has occurred during auth.
This commit is contained in:
AarDG10 2026-04-29 11:55:52 +05:30
parent 73a81e0c02
commit 38537b822d

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