aboutsummaryrefslogtreecommitdiff
path: root/juick-spring-www/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-12-11 21:20:32 +0700
committerGravatar Vitaly Takmazov2016-12-11 18:24:38 +0300
commitec0a90256b86890ad4549d0fff5c3fd373c918d4 (patch)
treeecde2e91e96e3f709ce3471b0b9eff778db75547 /juick-spring-www/src/main/java/com/juick
parent50309fc6e2362a22ae5d1e892b3c8a6a5ce39686 (diff)
i18n for login page; login failure url
Diffstat (limited to 'juick-spring-www/src/main/java/com/juick')
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/configuration/WebAppConfiguration.java8
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java2
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/controllers/PMController.java4
3 files changed, 13 insertions, 1 deletions
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<Message> 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";
}