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

main
Last change on this file since f194b4e 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
RevLine 
[f0232fb]1package finki.paw5.web.controllers;
2
[b00d81b]3import jakarta.servlet.http.HttpServletRequest;
[f0232fb]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
[b00d81b]13 public String getHomePage(HttpServletRequest request) {
14 if(request.getSession().getAttribute("user")==null){
15 return "redirect:/login";
16 }
[f0232fb]17 return "home";
18 }
[b00d81b]19
[f0232fb]20 @GetMapping("/aboutUs")
[b00d81b]21 public String getSuccessPage() {
[f0232fb]22 return "/aboutUs";
23 }
24}
Note: See TracBrowser for help on using the repository browser.