diff options
author | 2018-09-07 15:56:34 +0300 | |
---|---|---|
committer | 2018-09-07 15:56:34 +0300 | |
commit | 7e73ada4e2e568818f9221068c8687728f2c9ce8 (patch) | |
tree | c93d822718559b360ee39d6cd7b2522de8d52511 /juick-server/src/main/java/com/juick/server | |
parent | 6fc88562fbfdc3f66f9e6f4d96f0ad8199a50863 (diff) |
Fix referer redirect
Diffstat (limited to 'juick-server/src/main/java/com/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); |