diff --git a/MiniTwit/src/main/java/dk/itu/minitwit/controller/MiniTwitController.java b/MiniTwit/src/main/java/dk/itu/minitwit/controller/MiniTwitController.java index 0ba17ac..14e63d0 100644 --- a/MiniTwit/src/main/java/dk/itu/minitwit/controller/MiniTwitController.java +++ b/MiniTwit/src/main/java/dk/itu/minitwit/controller/MiniTwitController.java @@ -105,7 +105,14 @@ public String userTimeLine(@PathVariable("username") String username, HttpServle model.addAttribute("public", "false"); model.addAttribute("username", username); Boolean loggedIn = addUserToModel(model, session); - + + List arg = new ArrayList<>(); // + arg.add(username); // + List> users; // check if there is a user with this name + users = sqLite.queryDb("select * from user where user.username = ?", arg); // redirect to public if there is no such user + if (users.size()==0) return "redirect:/public"; // todo redirect to error page insted + + if (loggedIn) { //TODO bliver kaldt af favicon ?? // System.out.println("username: " + username);