aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-05 14:55:50 +0300
committerGravatar Vitaly Takmazov2018-02-05 14:55:50 +0300
commit8aa11c92f36a5fd2fbed24e8423c8b9e14efda5f (patch)
treea4afa29f2a0a4ba009709102c79339b9c788c5fc /juick-www/src/main/java/com
parentfa070e8e63fb25dabddc97a6c1c6b72c2b46b66f (diff)
www: fb and vk logins using hash redirects
Diffstat (limited to 'juick-www/src/main/java/com')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/FacebookLogin.java5
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/VKontakteLogin.java5
2 files changed, 2 insertions, 8 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 6e8d6864..2b2a89b2 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,10 +130,7 @@ public class FacebookLogin {
if (!crosspostService.updateFacebookUser(fbID, token.getAccessToken(), fb.getName(), fb.getLink())) {
throw new HttpBadRequestException();
}
- 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:/?hash=" + userService.getHashByUID(uid);
} 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 382c3194..23cbedff 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,10 +123,7 @@ public class VKontakteLogin {
Long vkID = NumberUtils.toLong(jsonUser.getUid(), 0);
int uid = crosspostService.getUIDbyVKID(vkID);
if (uid > 0) {
- 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:/?hash=" + userService.getHashByUID(uid);
} else {
String loginhash = UUID.randomUUID().toString();
if (!crosspostService.createVKUser(vkID, loginhash, token.getAccessToken(), vkName, vkLink)) {