add login redirect query param to login button
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import urllib.parse as url
|
||||||
from flask import Blueprint, render_template, g, redirect, session, url_for, request
|
from flask import Blueprint, render_template, g, redirect, session, url_for, request
|
||||||
|
|
||||||
from flask import current_app as app
|
from flask import current_app as app
|
||||||
@@ -16,7 +17,15 @@ bp = Blueprint("atst", __name__)
|
|||||||
|
|
||||||
@bp.route("/")
|
@bp.route("/")
|
||||||
def root():
|
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")
|
@bp.route("/help")
|
||||||
|
@@ -15,13 +15,20 @@
|
|||||||
|
|
||||||
<img class="login-banner__logo" src="/static/img/ccpo-logo.svg" alt="Cloud Computing Program Office Logo">
|
<img class="login-banner__logo" src="/static/img/ccpo-logo.svg" alt="Cloud Computing Program Office Logo">
|
||||||
|
|
||||||
<a class="usa-button usa-button-big login-banner__button" href='{{ config.get('CAC_URL','https://cac.atat.codes') }}'><span>Sign in with CAC</span></a>
|
<a class="usa-button usa-button-big login-banner__button" href='{{ redirect_url }}'><span>Sign in with CAC</span></a>
|
||||||
|
|
||||||
{% if g.dev %}
|
{% if g.dev %}
|
||||||
<a class="usa-button usa-button-big usa-button-secondary" href='/login-dev'><span>DEV Login</span></a>
|
<a class="usa-button usa-button-big usa-button-secondary" href='{{ url_for("dev.login_dev", **request.args) }}'><span>DEV Login</span></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% 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',
|
{{ Alert('Certificate Selection',
|
||||||
message='When you are prompted to select a certificate, please select <strong>E-mail Certificate</strong> from the provided choices.',
|
message='When you are prompted to select a certificate, please select <strong>E-mail Certificate</strong> from the provided choices.',
|
||||||
actions=[
|
actions=[
|
||||||
|
Reference in New Issue
Block a user