Skip to content

Commit

Permalink
Re-Add ability to cancel out of second factor authentication pages to…
Browse files Browse the repository at this point in the history
… return to primary login
  • Loading branch information
mseaton committed Dec 12, 2023
1 parent 833aa1c commit 2d24f05
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,14 @@ public String get(
@SpringBean("authenticationUiConfig") AuthenticationUiConfig authenticationUiConfig,
PageRequest request) {

AuthenticationSession authenticationSession = new AuthenticationSession(request.getRequest(), request.getResponse());
if (Context.isAuthenticated()) {
return "redirect:" + authenticationUiConfig.getHomePageUrl(ui);
}
else {
authenticationSession.getHttpSession().removeAttribute(AuthenticationSession.AUTHENTICATION_USER_LOGIN);
}

AuthenticationSession authenticationSession = new AuthenticationSession(request.getRequest(), request.getResponse());
List<Location> loginLocations = new ArrayList<>();
if (authenticationUiConfig.isShowLoginLocations()) {
String locationTagName = authenticationUiConfig.getLoginLocationTagName();
Expand Down
5 changes: 3 additions & 2 deletions omod/src/main/webapp/pages/login/loginSecret.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
<input type="hidden" name="question" value="${question}"/>
${ ui.message(question) }:
</label>
<input id="answer" type="password" name="answer" placeholder="${ ui.message("authenticationui.loginSecret.secret.placeholder") }"/>
<input id="answer" type="password" name="answer" tabindex="10" placeholder="${ ui.message("authenticationui.loginSecret.secret.placeholder") }"/>
</p>

<p>
<input id="login-button" class="confirm" type="submit" value="${ ui.message("authenticationui.loginSecret.button") }"/>
<input id="cancel-button" class="cancel" type="button" tabindex="30" value="${ ui.message("authenticationui.login.cancel") }" onclick="document.location.href='${ui.pageLink("authenticationui", "login/login")}'" />
<input id="login-button" class="confirm" type="submit" tabindex="20" value="${ ui.message("authenticationui.loginSecret.button") }"/>
</p>

</fieldset>
Expand Down
5 changes: 3 additions & 2 deletions omod/src/main/webapp/pages/login/loginTotp.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@

<p>
<label for="code-input">${ ui.message("authenticationui.loginTotp.code") }</label>
<input id="code-input" type="text" name="code" value="" placeholder="${ ui.message("authenticationui.loginTotp.code.placeholder") }"/>
<input id="code-input" type="text" name="code" tabindex="10" value="" placeholder="${ ui.message("authenticationui.loginTotp.code.placeholder") }"/>
</p>

<p>
<input id="login-button" class="confirm" type="submit" value="${ ui.message("authenticationui.loginTotp.button") }"/>
<input id="cancel-button" class="cancel" type="button" tabindex="30" value="${ ui.message("authenticationui.login.cancel") }" onclick="document.location.href='${ui.pageLink("authenticationui", "login/login")}'" />
<input id="login-button" class="confirm" type="submit" tabindex="20" value="${ ui.message("authenticationui.loginTotp.button") }"/>
</p>

</fieldset>
Expand Down

0 comments on commit 2d24f05

Please sign in to comment.