fix: check if user is diabled during api authentication

This commit is contained in:
Snehit Gunjikar 2025-03-20 19:58:10 +05:30
parent ba9bc4fb82
commit 10873ad49f

View file

@ -702,7 +702,7 @@ def validate_auth_via_api_keys(authorization_header):
def validate_api_key_secret(api_key, api_secret, frappe_authorization_source=None):
"""frappe_authorization_source to provide api key and secret for a doctype apart from User"""
doctype = frappe_authorization_source or "User"
doc = frappe.db.get_value(doctype=doctype, filters={"api_key": api_key}, fieldname=["name"])
doc = frappe.db.get_value(doctype=doctype, filters={"api_key": api_key, "enabled": True}, fieldname=["name"])
if not doc:
raise frappe.AuthenticationError
form_dict = frappe.local.form_dict