diff --git a/frappe/app.py b/frappe/app.py index e643896d33..6967b3c825 100644 --- a/frappe/app.py +++ b/frappe/app.py @@ -28,6 +28,7 @@ from frappe.middlewares import StaticDataMiddleware from frappe.utils import CallbackManager, cint, get_site_name from frappe.utils.data import escape_html from frappe.utils.error import log_error_snapshot +from frappe.website.page_renderers.error_page import ErrorPage from frappe.website.serve import get_response _site = None @@ -339,7 +340,6 @@ def make_form_dict(request: Request): def handle_exception(e): response = None http_status_code = getattr(e, "http_status_code", 500) - return_as_message = False accept_header = frappe.get_request_header("Accept") or "" respond_as_json = ( frappe.get_request_header("Accept") @@ -347,8 +347,6 @@ def handle_exception(e): or (frappe.local.request.path.startswith("/api/") and not accept_header.startswith("text")) ) - allow_traceback = frappe.get_system_settings("allow_error_traceback") if frappe.db else False - if not frappe.session.user: # If session creation fails then user won't be unset. This causes a lot of code that # assumes presence of this to fail. Session creation fails => guest or expired login @@ -371,45 +369,33 @@ def handle_exception(e): http_status_code = 508 elif http_status_code == 401: - frappe.respond_as_web_page( - _("Session Expired"), - _("Your session has expired, please login again to continue."), + response = ErrorPage( http_status_code=http_status_code, - indicator_color="red", - ) - return_as_message = True + title=_("Session Expired"), + message=_("Your session has expired, please login again to continue."), + ).render() elif http_status_code == 403: - frappe.respond_as_web_page( - _("Not Permitted"), - _("You do not have enough permissions to complete the action"), + response = ErrorPage( http_status_code=http_status_code, - indicator_color="red", - ) - return_as_message = True + title=_("Not Permitted"), + message=_("You do not have enough permissions to complete the action"), + ).render() elif http_status_code == 404: - frappe.respond_as_web_page( - _("Not Found"), - _("The resource you are looking for is not available"), + response = ErrorPage( http_status_code=http_status_code, - indicator_color="red", - ) - return_as_message = True + title=_("Not Found"), + message=_("The resource you are looking for is not available"), + ).render() elif http_status_code == 429: response = frappe.rate_limiter.respond() else: - traceback = "
" + escape_html(frappe.get_traceback()) + "
" - # disable traceback in production if flag is set - if frappe.local.flags.disable_traceback or not allow_traceback and not frappe.local.dev_server: - traceback = "" - - frappe.respond_as_web_page( - "Server Error", traceback, http_status_code=http_status_code, indicator_color="red", width=640 - ) - return_as_message = True + response = ErrorPage( + http_status_code=http_status_code, title=_("Server Error"), message=_("Uncaught Exception") + ).render() if e.__class__ == frappe.AuthenticationError: if hasattr(frappe.local, "login_manager"): @@ -418,9 +404,6 @@ def handle_exception(e): if http_status_code >= 500: log_error_snapshot(e) - if return_as_message: - response = get_response("message", http_status_code=http_status_code) - if frappe.conf.get("developer_mode") and not respond_as_json: # don't fail silently for non-json response errors print(frappe.get_traceback()) diff --git a/frappe/integrations/oauth2.py b/frappe/integrations/oauth2.py index 369539e634..f04351eda5 100644 --- a/frappe/integrations/oauth2.py +++ b/frappe/integrations/oauth2.py @@ -74,7 +74,7 @@ def approve(*args, **kwargs): @frappe.whitelist(allow_guest=True) def authorize(**kwargs): success_url = "/api/method/frappe.integrations.oauth2.approve?" + encode_params(sanitize_kwargs(kwargs)) - failure_url = frappe.form_dict["redirect_uri"] + "?error=access_denied" + failure_url = frappe.form_dict.get("redirect_uri", "") + "?error=access_denied" if frappe.session.user == "Guest": # Force login, redirect to preauth again. diff --git a/frappe/public/scss/desk/sidebar.scss b/frappe/public/scss/desk/sidebar.scss index 2067515e1a..8926db98dd 100644 --- a/frappe/public/scss/desk/sidebar.scss +++ b/frappe/public/scss/desk/sidebar.scss @@ -57,7 +57,7 @@ body { .body-sidebar-placeholder { display: none; - width: 53px; + width: 50px; height: 100vh; } } diff --git a/frappe/public/scss/website/portal.scss b/frappe/public/scss/website/portal.scss index f65acb6c8b..e5dcd5e277 100644 --- a/frappe/public/scss/website/portal.scss +++ b/frappe/public/scss/website/portal.scss @@ -56,6 +56,12 @@ font-weight: var(--weight-semibold); font-size: var(--text-lg); color: var(--text-color); + + p { + font-weight: normal; + font-size: var(--text-base); + color: var(--text-light); + } } } diff --git a/frappe/templates/includes/oauth_confirmation.html b/frappe/templates/includes/oauth_confirmation.html index 8e1df6c57c..febd23f9d6 100644 --- a/frappe/templates/includes/oauth_confirmation.html +++ b/frappe/templates/includes/oauth_confirmation.html @@ -1,21 +1,24 @@ {% if not error %} -
-
-
{{ _(client_id) }}
-

{{ _("wants to access the following details from your account") }}

-
-
- -
- - -
-
+ +
+
+

{{ _(client_id) }} {{ _("wants to access the following details from your account") }}

+
+
+ {% for dtl in details %} +
+ {{ _(dtl.title()) }} +
+ {% endfor %} +
+
+
+ + +
+
+