diff options
author | Vitaly Takmazov | 2018-02-05 15:06:12 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-02-05 15:09:04 +0300 |
commit | 18c0b338455c4ebf16d3720b6f9a92d17b0d5b70 (patch) | |
tree | 918deeb7149c0f2d3e590632ff93916132082b14 /juick-www/src/main/java/com | |
parent | e372eea0cf03a01d5c1ac3ae230406d7d9de6fd0 (diff) |
Revert "www: fb and vk logins using hash redirects"
This partially reverts commit 8aa11c92f36a5fd2fbed24e8423c8b9e14efda5f.
Diffstat (limited to 'juick-www/src/main/java/com')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java | 5 | ||||
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java index 2b2a89b2a..6e8d68643 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java +++ b/juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java @@ -130,7 +130,10 @@ public class FacebookLogin { if (!crosspostService.updateFacebookUser(fbID, token.getAccessToken(), fb.getName(), fb.getLink())) { throw new HttpBadRequestException(); } - return "redirect:/?hash=" + userService.getHashByUID(uid); + Cookie c = new Cookie("hash", userService.getHashByUID(uid)); + c.setMaxAge(50 * 24 * 60 * 60); + response.addCookie(c); + return Utils.getPreviousPageByRequest(request).orElse("redirect:/"); } else if (fb.getVerified()) { String loginhash = UUID.randomUUID().toString(); if (!crosspostService.createFacebookUser(fbID, loginhash, token.getAccessToken(), fb.getName(), fb.getLink())) { diff --git a/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java b/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java index 23cbedfff..382c31943 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java +++ b/juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java @@ -123,7 +123,10 @@ public class VKontakteLogin { Long vkID = NumberUtils.toLong(jsonUser.getUid(), 0); int uid = crosspostService.getUIDbyVKID(vkID); if (uid > 0) { - return "redirect:/?hash=" + userService.getHashByUID(uid); + Cookie c = new Cookie("hash", userService.getHashByUID(uid)); + c.setMaxAge(50 * 24 * 60 * 60); + response.addCookie(c); + return Utils.getPreviousPageByRequest(request).orElse("redirect:/"); } else { String loginhash = UUID.randomUUID().toString(); if (!crosspostService.createVKUser(vkID, loginhash, token.getAccessToken(), vkName, vkLink)) { |