diff --git a/myconext-gui/src/routes/Landing.svelte b/myconext-gui/src/routes/Landing.svelte index 2f1f2d31..ff6591ca 100644 --- a/myconext-gui/src/routes/Landing.svelte +++ b/myconext-gui/src/routes/Landing.svelte @@ -18,7 +18,7 @@ }); const loginAgain = () => { - window.location.href = `${$config.idpBaseUrl}/doLogin`; + window.location.href = `${$config.idpBaseUrl}/doLogin?register=false`; } diff --git a/myconext-server/src/main/java/myconext/api/LoginController.java b/myconext-server/src/main/java/myconext/api/LoginController.java index b885f5ae..92b17bbd 100644 --- a/myconext-server/src/main/java/myconext/api/LoginController.java +++ b/myconext-server/src/main/java/myconext/api/LoginController.java @@ -93,7 +93,7 @@ public Map config() { public void register(@RequestParam(value = "lang", required = false, defaultValue = "en") String lang, @RequestParam(value = "location", required = false) String location, HttpServletResponse response) throws IOException { - doRedirect(lang, location, response); + doRedirect(lang, location, response, true); } @GetMapping("/register/{enrollmentVerificationKey}") @@ -125,13 +125,16 @@ public void register(@PathVariable("enrollmentVerificationKey") String enrollmen @GetMapping("/doLogin") public void doLogin(@RequestParam(value = "lang", required = false, defaultValue = "en") String lang, @RequestParam(value = "location", required = false) String location, + @RequestParam(value = "register", required = false, defaultValue = "true") String register, HttpServletResponse response) throws IOException { - doRedirect(lang, location, response); + doRedirect(lang, location, response, Boolean.valueOf(register)); } - private void doRedirect(String lang, String location, HttpServletResponse response) throws IOException { - String cookieValue = String.format("%s=true; Max-Age=%s; SameSite=None%s", REGISTER_MODUS_COOKIE_NAME, 60 * 10, secureCookie ? "; Secure" : ""); - response.setHeader("Set-Cookie", cookieValue); + private void doRedirect(String lang, String location, HttpServletResponse response, boolean register) throws IOException { + if (register) { + String cookieValue = String.format("%s=true; Max-Age=%s; SameSite=None%s", REGISTER_MODUS_COOKIE_NAME, 60 * 10, secureCookie ? "; Secure" : ""); + response.setHeader("Set-Cookie", cookieValue); + } String redirectLocation = StringUtils.hasText(location) ? location : this.config.get("eduIDLoginUrl") + "&lang=" + lang; response.sendRedirect(redirectLocation); }