From 9f4b284d6ced327fa4db399223aa15867e1cec5e Mon Sep 17 00:00:00 2001 From: dandds Date: Mon, 1 Oct 2018 13:53:09 -0400 Subject: [PATCH] add login redirect query param to login button --- atst/routes/__init__.py | 11 ++++++++++- templates/login.html | 11 +++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/atst/routes/__init__.py b/atst/routes/__init__.py index c3536ae5..beaa0c8e 100644 --- a/atst/routes/__init__.py +++ b/atst/routes/__init__.py @@ -1,3 +1,4 @@ +import urllib.parse as url from flask import Blueprint, render_template, g, redirect, session, url_for, request from flask import current_app as app @@ -16,7 +17,15 @@ bp = Blueprint("atst", __name__) @bp.route("/") def root(): - return render_template("login.html") + redirect_url = app.config.get("CAC_URL") + if request.args.get("next"): + redirect_url = url.urljoin( + redirect_url, "?{}".format(url.urlencode(request.args)) + ) + + return render_template( + "login.html", redirect=bool(request.args.get("next")), redirect_url=redirect_url + ) @bp.route("/help") diff --git a/templates/login.html b/templates/login.html index 7beaee66..0ff48b72 100644 --- a/templates/login.html +++ b/templates/login.html @@ -15,13 +15,20 @@ - Sign in with CAC + Sign in with CAC {% if g.dev %} - DEV Login + DEV Login {% endif %} + {% if redirect %} + {{ Alert('Log in Required.', + message='After you log in, you will be redirected to your destination page.', + level='warning' + ) }} + {% endif %} + {{ Alert('Certificate Selection', message='When you are prompted to select a certificate, please select E-mail Certificate from the provided choices.', actions=[