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 --- .../java/com/juick/www/configuration/WebAppConfiguration.java | 8 ++++++++ .../main/java/com/juick/www/configuration/WebSecurityConfig.java | 2 +- .../src/main/java/com/juick/www/controllers/PMController.java | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'juick-spring-www/src/main/java/com') 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"; } -- cgit v1.2.3