From 1eb1466860056c4b07132ed1100f4cd7fb1ee77d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20LELEU?= <jerome.leleu@teamdlab.com> Date: Thu, 30 Apr 2020 12:06:57 +0200 Subject: [PATCH] fix back links --- .../actions/CustomDelegatedClientAuthenticationAction.java | 6 ++++++ .../src/main/resources/templates/casLoginView.html | 2 +- cas/cas-server/src/main/resources/templates/casPwdView.html | 2 +- cas/cas-server/src/main/resources/templates/layout.html | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java b/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java index 28a8cbc6..987eeb6a 100644 --- a/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java +++ b/cas/cas-server/src/main/java/fr/gouv/vitamui/cas/webflow/actions/CustomDelegatedClientAuthenticationAction.java @@ -140,6 +140,12 @@ public class CustomDelegatedClientAuthenticationAction extends DelegatedClientAu val flowScope = context.getFlowScope(); flowScope.put(Constants.PORTAL_URL, vitamuiPortalUrl); + // retrieve the service if it exists to prepare the serviceUrl parameter (for the back links) + val service = WebUtils.getService(context); + if (service != null) { + flowScope.put("serviceUrl", service.getOriginalUrl()); + } + val event = super.doExecute(context); if ("error".equals(event.getId())) { diff --git a/cas/cas-server/src/main/resources/templates/casLoginView.html b/cas/cas-server/src/main/resources/templates/casLoginView.html index a2a468e8..5c9d6e54 100644 --- a/cas/cas-server/src/main/resources/templates/casLoginView.html +++ b/cas/cas-server/src/main/resources/templates/casLoginView.html @@ -110,7 +110,7 @@ <button type="submit" class="vitamui-primary" name="submit" accesskey="l" th:value="Suivant" tabindex="6">OK</button> </form> <p class="helper">Appuyez sur <strong>Entrée</strong> pour valider</p> - <button class="back" type="button" th:onclick="|location.href = '@{/login}';|" th:if="${!#strings.isEmpty(superUser)}"> + <button class="back" type="button" th:onclick="|location.href = '@{/login(service=${serviceUrl})}';|" th:if="${!#strings.isEmpty(superUser)}"> <i class="material-icons">arrow_back</i> Retour </button> </div> diff --git a/cas/cas-server/src/main/resources/templates/casPwdView.html b/cas/cas-server/src/main/resources/templates/casPwdView.html index 3e02c27a..e65cf6f8 100644 --- a/cas/cas-server/src/main/resources/templates/casPwdView.html +++ b/cas/cas-server/src/main/resources/templates/casPwdView.html @@ -96,7 +96,7 @@ </button> </form> - <button class="back" type="button" th:onclick="|location.href = '@{/login}';|"> + <button class="back" type="button" th:onclick="|location.href = '@{/login(service=${serviceUrl})}';|"> <i class="material-icons">arrow_back</i> Retour </button> </div> diff --git a/cas/cas-server/src/main/resources/templates/layout.html b/cas/cas-server/src/main/resources/templates/layout.html index 8606b2fd..5f759a0e 100644 --- a/cas/cas-server/src/main/resources/templates/layout.html +++ b/cas/cas-server/src/main/resources/templates/layout.html @@ -59,7 +59,7 @@ <p/> </div> - <button class="back" type="button" th:onclick="|location.href = '@{/login}';|"> + <button class="back" type="button" th:onclick="|location.href = '@{/login(service=${serviceUrl})}';|"> <i class="material-icons">arrow_back</i> Retour </button> </div> -- GitLab