diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/juick/www/controllers/Site.java | 7 | ||||
-rw-r--r-- | src/main/java/com/juick/www/controllers/SocialLogin.java | 2 | ||||
-rw-r--r-- | src/main/resources/templates/views/login.html | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java index 1dc4c338..1169414f 100644 --- a/src/main/java/com/juick/www/controllers/Site.java +++ b/src/main/java/com/juick/www/controllers/Site.java @@ -34,6 +34,7 @@ import com.juick.util.MessageUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.text.StringEscapeUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -74,6 +75,10 @@ public class Site { private WebApp webApp; @Inject private User serviceUser; + @Value("${web_domain:localhost}") + private String webDomain; + @Value("${telegram_botname:Juick_bot}") + private String tgBot; private void fillUserModel(ModelMap model, User user, User visitor) { user.setAvatar(webApp.getAvatarWebPath(user)); @@ -103,6 +108,8 @@ public class Site { } model.addAttribute("visitor", visitor); model.addAttribute("tags", tagService.getPopularTags()); + model.addAttribute("domain", webDomain); + model.addAttribute("tgBot", tgBot); AuthenticationException authEx = (AuthenticationException) session .getAttribute(WebAttributes.AUTHENTICATION_EXCEPTION); diff --git a/src/main/java/com/juick/www/controllers/SocialLogin.java b/src/main/java/com/juick/www/controllers/SocialLogin.java index 24bf97f6..3d8e7027 100644 --- a/src/main/java/com/juick/www/controllers/SocialLogin.java +++ b/src/main/java/com/juick/www/controllers/SocialLogin.java @@ -306,7 +306,7 @@ public class SocialLogin { Cookie c = new Cookie("hash", userService.getHashByUID(uid)); c.setMaxAge(50 * 24 * 60 * 60); response.addCookie(c); - return "redirect:/" + Optional.ofNullable(referer).orElse(StringUtils.EMPTY); + return "redirect:" + Optional.ofNullable(referer).orElse(StringUtils.EMPTY); } else { String username = StringUtils.defaultString(params.get("username"), params.get("first_name")); List<Long> chats = telegramService.getAnonymous(); diff --git a/src/main/resources/templates/views/login.html b/src/main/resources/templates/views/login.html index 046e5b09..070e1add 100644 --- a/src/main/resources/templates/views/login.html +++ b/src/main/resources/templates/views/login.html @@ -27,8 +27,8 @@ <div id="facebook"><a href="/_fblogin" rel="nofollow">Facebook</a></div> <div id="vk"><a href="/_vklogin" rel="nofollow">ВКонтакте</a></div> <div id="tg"> - <script async src="https://telegram.org/js/telegram-widget.js?3" data-telegram-login="Juick_bot" - data-size="medium" data-radius="0" data-auth-url="https://juick.com/_tglogin" + <script async src="https://telegram.org/js/telegram-widget.js?21" data-telegram-login="{{ tgBot }}" + data-size="medium" data-radius="0" data-auth-url="https://{{ domain }}/_tglogin" data-request-access="write"></script> </div> <div id="apple"> |