From ec0a90256b86890ad4549d0fff5c3fd373c918d4 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Sun, 11 Dec 2016 21:20:32 +0700 Subject: i18n for login page; login failure url --- .../www/configuration/WebAppConfiguration.java | 8 + .../juick/www/configuration/WebSecurityConfig.java | 2 +- .../com/juick/www/controllers/PMController.java | 4 + .../src/main/resources/messages.properties | 13 +- .../src/main/resources/messages_en.properties | 11 +- .../main/webapp/WEB-INF/templates/views/login.html | 193 +++++++++++---------- .../WEB-INF/templates/views/partial/footer.html | 2 +- juick-spring-www/src/main/webapp/tagscloud.png | Bin 0 -> 42316 bytes 8 files changed, 134 insertions(+), 99 deletions(-) create mode 100644 juick-spring-www/src/main/webapp/tagscloud.png (limited to 'juick-spring-www/src/main') diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java index b314db64..a6632289 100644 --- a/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java +++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java @@ -5,6 +5,8 @@ import com.juick.www.WebApp; import com.juick.www.settings.TemplateSettingsHolder; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.guava.GuavaCacheManager; +import org.springframework.cache.interceptor.KeyGenerator; +import org.springframework.cache.interceptor.SimpleKeyGenerator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; @@ -54,4 +56,10 @@ public class WebAppConfiguration { public HelpService helpService() { return new HelpService("help"); } + + @Bean + public KeyGenerator keyGenerator() { + // configure and return an implementation of Spring's KeyGenerator SPI + return new SimpleKeyGenerator(); + } } diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java index 551c0185..bb6387d6 100644 --- a/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java +++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java @@ -48,10 +48,10 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .loginPage("/login") .permitAll() .defaultSuccessUrl("/") - .failureForwardUrl("/login?error=1") .loginProcessingUrl("/do_login") .usernameParameter("j_username") .passwordParameter("j_password") + .failureUrl("/login?error=1") .and() .rememberMe() .tokenValiditySeconds(6 * 30 * 24 * 3600) diff --git a/juick-spring-www/src/main/java/com/juick/www/controllers/PMController.java b/juick-spring-www/src/main/java/com/juick/www/controllers/PMController.java index 41c6b33c..d40e7aaf 100644 --- a/juick-spring-www/src/main/java/com/juick/www/controllers/PMController.java +++ b/juick-spring-www/src/main/java/com/juick/www/controllers/PMController.java @@ -42,13 +42,17 @@ public class PMController { @RequestMapping("/pm/inbox") public String doGetInbox(ModelMap context) { User visitor = UserUtils.getCurrentUser(); + String title = "PM: Inbox"; List msgs = pmQueriesService.getLastPMInbox(visitor.getUid()); + msgs.forEach(m -> m.setText(MessageUtils.formatMessage(m.getText()))); + context.put("title", title); context.put("visitor", visitor); context.put("msgs", msgs); context.put("tags", tagService.getPopularTags()); + return "views/pm_inbox"; } diff --git a/juick-spring-www/src/main/resources/messages.properties b/juick-spring-www/src/main/resources/messages.properties index a7034c5f..201c1f2c 100644 --- a/juick-spring-www/src/main/resources/messages.properties +++ b/juick-spring-www/src/main/resources/messages.properties @@ -19,7 +19,16 @@ link.logout=Выйти label.sponsor=Спонсор label.sponsors=Спонсоры label.search=Поиск +label.register=Зарегистрироваться +label.username=Имя пользователя +label.password=Пароль -message.loginForSending=Чтобы добавлять сообщения и комментарии, представьтесь +button.send=Отправить -title.help=Справка \ No newline at end of file +message.loginForSending=Чтобы добавлять сообщения и комментарии, представьтесь +message.sendLoginToXmpp=Отправьте LOGIN на juick@juick.com + +question.areRegistered=Уже зарегистрированы? + +title.help=Справка +title.loginOrSignup=Juick - Войдите в систему или зарегистрируйтесь \ No newline at end of file diff --git a/juick-spring-www/src/main/resources/messages_en.properties b/juick-spring-www/src/main/resources/messages_en.properties index 02c83e12..8b1384cb 100644 --- a/juick-spring-www/src/main/resources/messages_en.properties +++ b/juick-spring-www/src/main/resources/messages_en.properties @@ -19,7 +19,16 @@ link.logout=Logout label.sponsor=Sponsor label.sponsors=Sponsors label.search=Search +label.register=Register +label.username=User name +label.password=Password + +button.send=Send message.loginForSending=Login for post messages and comments +message.sendLoginToXmpp=Send LOGIN to juick@juick.com + +question.areRegistered=Are you registered? -title.help=Help \ No newline at end of file +title.help=Help +title.loginOrSignup=Juick - Log In or Sign Up \ No newline at end of file diff --git a/juick-spring-www/src/main/webapp/WEB-INF/templates/views/login.html b/juick-spring-www/src/main/webapp/WEB-INF/templates/views/login.html index 990797c9..d2e424cd 100644 --- a/juick-spring-www/src/main/webapp/WEB-INF/templates/views/login.html +++ b/juick-spring-www/src/main/webapp/WEB-INF/templates/views/login.html @@ -1,7 +1,11 @@ - + - Juick + + + + + Juick - + - -
juick.com © 2008-2016   Контакты · Помощь
+
juick.com © 2008-2017   Контакты · Помощь
- Зарегистрироваться: + Зарегистрироваться: - +
XMPP -
Отправьте LOGIN на juick@@juick.com
+
[(#{message.sendLoginToXmpp})]
-
Уже зарегистрированы? -
- - - -
+ - \ No newline at end of file diff --git a/juick-spring-www/src/main/webapp/WEB-INF/templates/views/partial/footer.html b/juick-spring-www/src/main/webapp/WEB-INF/templates/views/partial/footer.html index fb53eb20..fc4b7384 100644 --- a/juick-spring-www/src/main/webapp/WEB-INF/templates/views/partial/footer.html +++ b/juick-spring-www/src/main/webapp/WEB-INF/templates/views/partial/footer.html @@ -16,7 +16,7 @@ Facebook
diff --git a/juick-spring-www/src/main/webapp/tagscloud.png b/juick-spring-www/src/main/webapp/tagscloud.png new file mode 100644 index 00000000..3e1bf169 Binary files /dev/null and b/juick-spring-www/src/main/webapp/tagscloud.png differ -- cgit v1.2.3