aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www/controllers')
-rw-r--r--src/main/java/com/juick/www/controllers/Site.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java
index a0b8c5b0..aa6d574d 100644
--- a/src/main/java/com/juick/www/controllers/Site.java
+++ b/src/main/java/com/juick/www/controllers/Site.java
@@ -46,6 +46,7 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import javax.inject.Inject;
import java.net.URLEncoder;
@@ -96,10 +97,12 @@ public class Site {
}
@GetMapping("/login")
- public String getloginForm(@Visitor User visitor, HttpSession session,
- @RequestParam(required = false, defaultValue = "true") boolean redirect, ModelMap model) {
+ public String getloginForm(@Visitor User visitor,
+ @RequestParam(name = "retpath", required = false, defaultValue = "/") String retPath,
+ HttpSession session,
+ ModelMap model) {
if (!visitor.isAnonymous()) {
- return redirect ? "redirect:/" : "redirect:/login/success";
+ return String.format("redirect:%s", retPath);
}
model.addAttribute("visitor", visitor);
model.addAttribute("tags", tagService.getPopularTags());
@@ -119,12 +122,6 @@ public class Site {
return "views/login";
}
- @GetMapping("/login/success")
- public String getSuccessLogin(@Visitor User visitor, ModelMap model) {
- model.addAttribute("hash", userService.getHashByUID(visitor.getUid()));
- return "views/login_success";
- }
-
@GetMapping("/")
protected String doGet(@Visitor User visitor, Locale locale, @RequestParam(required = false) String tag,
@RequestParam(name = "show", required = false) String paramShow,