diff options
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/UserThread.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java index 5765e02d..6c2e0031 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/UserThread.java +++ b/juick-www/src/main/java/com/juick/www/controllers/UserThread.java @@ -62,6 +62,7 @@ public class UserThread { @RequestMapping(value = "/{uname}/{mid}", method = RequestMethod.GET) protected void doGetThread(HttpServletRequest request, HttpServletResponse response, + @PathVariable String uname, @PathVariable int mid) throws ServletException, IOException { com.juick.User visitor = webApp.getVisitorUser(request, response); @@ -76,6 +77,12 @@ public class UserThread { throw new HttpNotFoundException(); } + com.juick.User user = userService.getUserByName(uname); + if (user.getUid() == 0 || !msg.getUser().equals(user)) { + response.sendRedirect(String.format("/%s/%d", msg.getUser().getName(), mid)); + return; + } + boolean listview = false; String paramView = request.getParameter("view"); if (paramView != null) { |