diff --git a/templates/zerver/config_error/container.html b/templates/zerver/config_error/container.html index 7d07c29715..05aa286098 100644 --- a/templates/zerver/config_error/container.html +++ b/templates/zerver/config_error/container.html @@ -22,7 +22,7 @@

After making your changes, remember to restart the Zulip server.

-

Refresh to try again or click here to go back to the login page.

+

Refresh to try again or go back to {{ go_back_to_url_name }}.

diff --git a/zerver/views/errors.py b/zerver/views/errors.py index 6293811680..3a745ad29e 100644 --- a/zerver/views/errors.py +++ b/zerver/views/errors.py @@ -1,12 +1,22 @@ +from typing import Optional + from django.conf import settings from django.http import HttpRequest, HttpResponse from django.shortcuts import render -def config_error(request: HttpRequest, error_name: str) -> HttpResponse: +def config_error( + request: HttpRequest, + error_name: str, + *, + go_back_to_url: Optional[str] = None, + go_back_to_url_name: Optional[str] = None, +) -> HttpResponse: assert "/" not in error_name context = { "error_name": error_name, + "go_back_to_url": go_back_to_url or "/login/", + "go_back_to_url_name": go_back_to_url_name or "the login page", } if settings.DEVELOPMENT: context["auth_settings_path"] = "zproject/dev-secrets.conf" diff --git a/zerver/views/push_notifications.py b/zerver/views/push_notifications.py index 9308ed4474..18048df994 100644 --- a/zerver/views/push_notifications.py +++ b/zerver/views/push_notifications.py @@ -234,4 +234,9 @@ def self_hosting_auth_not_configured(request: HttpRequest) -> HttpResponse: # is actually real. return render(request, "404.html", status=404) - return config_error(request, "remote_billing_bouncer_not_configured") + return config_error( + request, + "remote_billing_bouncer_not_configured", + go_back_to_url="/", + go_back_to_url_name="the app", + )