fix: enhance error handling in password reset process

This commit is contained in:
shariquerik 2026-04-15 12:02:20 +05:30
parent a0f4526c58
commit 9f92e7bf0d

View file

@ -1167,7 +1167,12 @@ def reset_password(user: str) -> str:
# For Administrator or disabled users: silently skip — same response below
except frappe.DoesNotExistError:
frappe.clear_messages()
# Do not reveal whether the account exists — fall through to generic response
except frappe.OutgoingEmailError:
frappe.clear_messages()
frappe.log_error(title="Password reset email could not be sent", message=frappe.get_traceback())
except Exception:
frappe.clear_messages()
frappe.log_error(title="Password reset failed unexpectedly", message=frappe.get_traceback())
return frappe.msgprint(
msg=_("If an account with this email exists, password reset instructions have been sent."),