diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index 8e95f1a5d9..dacbd059a9 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -442,7 +442,7 @@ class User(Document): if password_expired: url = "/update-password?key=" + key + "&password_expired=true" - link = get_url(url) + link = get_url(url, allow_header_override=False) if send_email: self.password_reset_mail(link) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index 06fbe28b44..28e6ac1eba 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -1781,7 +1781,11 @@ def filter_strip_join(some_list: list[str], sep: str) -> list[str]: return (cstr(sep)).join(cstr(a).strip() for a in filter(None, some_list)) -def get_url(uri: str | None = None, full_address: bool = False) -> str: +def get_url( + uri: str | None = None, + full_address: bool = False, + allow_header_override: bool = True, +) -> str: """Get app url from request.""" host_name = frappe.local.conf.host_name or frappe.local.conf.hostname @@ -1791,7 +1795,7 @@ def get_url(uri: str | None = None, full_address: bool = False) -> str: if not host_name: request_host_name = get_host_name_from_request() - if request_host_name: + if request_host_name and allow_header_override: host_name = request_host_name elif frappe.local.site: