diff options
Diffstat (limited to 'juick-server')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/www/Utils.java | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/juick-server/src/main/java/com/juick/server/www/Utils.java b/juick-server/src/main/java/com/juick/server/www/Utils.java index 61278e17..e53c142b 100644 --- a/juick-server/src/main/java/com/juick/server/www/Utils.java +++ b/juick-server/src/main/java/com/juick/server/www/Utils.java @@ -40,6 +40,6 @@ public class Utils { */ public static Optional<String> getPreviousPageByRequest(HttpServletRequest request) { - return Optional.ofNullable(request.getHeader("Referer")).map(requestUrl -> "redirect:" + requestUrl); + return Optional.ofNullable(request.getHeader("Referer")); } } diff --git a/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java b/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java index 5f21e052..46e25d81 100644 --- a/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java +++ b/juick-server/src/main/java/com/juick/server/www/controllers/SocialLogin.java @@ -280,7 +280,7 @@ public class SocialLogin { Cookie c = new Cookie("hash", userService.getHashByUID(uid)); c.setMaxAge(50 * 24 * 60 * 60); response.addCookie(c); - return Utils.getPreviousPageByRequest(request).orElse("redirect:/"); + return "redirect:/" + Utils.getPreviousPageByRequest(request).orElse(StringUtils.EMPTY); } else { String loginhash = UUID.randomUUID().toString(); if (!crosspostService.createVKUser(vkID, loginhash, token.getAccessToken(), vkName, vkLink)) { @@ -310,7 +310,7 @@ public class SocialLogin { Cookie c = new Cookie("hash", userService.getHashByUID(uid)); c.setMaxAge(50 * 24 * 60 * 60); response.addCookie(c); - return Utils.getPreviousPageByRequest(request).orElse("redirect:/"); + return "redirect:/" + Utils.getPreviousPageByRequest(request).orElse(StringUtils.EMPTY); } else { String username = StringUtils.defaultString(params.get("username"), params.get("first_name")); telegramService.createTelegramUser(tgUser, username); |