From 927f150d4f6a58c068537fe9326527a71a0f0000 Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 3 Apr 2024 16:52:25 -0400 Subject: [PATCH] use backend url in local openid login page w/ burnettk --- .../openid_blueprint/openid_blueprint.py | 4 + .../openid_blueprint/templates/login.html | 78 +++++++++++++------ 2 files changed, 59 insertions(+), 23 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py index c4e88da9d..1e77b8f74 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/openid_blueprint.py @@ -55,6 +55,7 @@ def well_known() -> dict: @openid_blueprint.route("/auth", methods=["GET"]) def auth() -> str: """Accepts a series of parameters.""" + host_url = current_app.config.get("SPIFFWORKFLOW_BACKEND_URL") or request.host_url.strip("/") return render_template( "login.html", state=request.args.get("state"), @@ -63,6 +64,7 @@ def auth() -> str: scope=request.args.get("scope"), redirect_uri=request.args.get("redirect_uri"), error_message=request.args.get("error_message", ""), + host_url=host_url, ) @@ -81,6 +83,7 @@ def form_submit() -> Any: url = request.values.get("redirect_uri") + "?" + urlencode(data) return redirect(url) else: + host_url = current_app.config.get("SPIFFWORKFLOW_BACKEND_URL") or request.host_url.strip("/") return render_template( "login.html", state=request.values.get("state"), @@ -89,6 +92,7 @@ def form_submit() -> Any: scope=request.values.get("scope"), redirect_uri=request.values.get("redirect_uri"), error_message="Login failed. Please try again.", + host_url=host_url, ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html index 815275d2b..26d2e97a8 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/openid_blueprint/templates/login.html @@ -1,38 +1,70 @@ - + - + Login Form - - - + + +
- Small SpiffWorkflow logo + Small SpiffWorkflow logo

Login

{{error_message}}
-
-

Important: This login form is for demonstration purposes only. In production systems you should - be using a real Open ID System.

- -

- -

- - - - - - -

+ +

+ Important: This login form is for demonstration purposes only. + In production systems you should be using a real Open ID System. +

+ +

+ +

+ + + + + + +

-
-
- + + +