aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-02-15 14:38:52 +0300
committerGravatar Vitaly Takmazov2018-02-15 14:38:52 +0300
commitf3688408e1513fdd7c0af0a28b5d82be31d5cced (patch)
treef69b0dfbbea85d6a42eaeea88ab65a8bbea5ffc7 /juick-www/src
parent5627e75ae2e816227d1274aceeb2d5c138d27278 (diff)
www: register telegram user
Diffstat (limited to 'juick-www/src')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/SocialLogin.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/SocialLogin.java b/juick-www/src/main/java/com/juick/www/controllers/SocialLogin.java
index b9d3c9c7..64d59b9f 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/SocialLogin.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/SocialLogin.java
@@ -311,7 +311,9 @@ public class SocialLogin {
response.addCookie(c);
return Utils.getPreviousPageByRequest(request).orElse("redirect:/");
} else {
- logger.warn("invalid user {}", tgUser);
+ String username = StringUtils.defaultString(params.get("username"), params.get("first_name"));
+ telegramService.createTelegramUser(tgUser, username);
+ return "redirect:/signup?type=durov&hash=" + userService.getSignUpHashByTelegramID(tgUser, username);
}
} else {
logger.warn("invalid tg hash {} for {}", resultString, hash);