source: Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/HomeController.java@ b00d81b

main
Last change on this file since b00d81b was b00d81b, checked in by SazdovaEkaterina <sazdovaekaterina@…>, 16 months ago

home redirects to login if not logged in

  • Property mode set to 100644
File size: 641 bytes
Line 
1package finki.paw5.web.controllers;
2
3import jakarta.servlet.http.HttpServletRequest;
4import org.springframework.stereotype.Controller;
5import org.springframework.web.bind.annotation.GetMapping;
6import org.springframework.web.bind.annotation.RequestMapping;
7
8@Controller
9@RequestMapping("/home")
10public class HomeController {
11
12 @GetMapping
13 public String getHomePage(HttpServletRequest request) {
14 if(request.getSession().getAttribute("user")==null){
15 return "redirect:/login";
16 }
17 return "home";
18 }
19
20 @GetMapping("/aboutUs")
21 public String getSuccessPage() {
22 return "/aboutUs";
23 }
24}
Note: See TracBrowser for help on using the repository browser.