Changeset b00d81b


Ignore:
Timestamp:
03/03/23 22:20:43 (16 months ago)
Author:
SazdovaEkaterina <sazdovaekaterina@…>
Branches:
main
Children:
3e59177
Parents:
d7eaf88
Message:

home redirects to login if not logged in

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/HomeController.java

    rd7eaf88 rb00d81b  
    11package finki.paw5.web.controllers;
    22
     3import jakarta.servlet.http.HttpServletRequest;
    34import org.springframework.stereotype.Controller;
    45import org.springframework.web.bind.annotation.GetMapping;
     
    1011
    1112    @GetMapping
    12     public String getHomePage(){
     13    public String getHomePage(HttpServletRequest request) {
     14        if(request.getSession().getAttribute("user")==null){
     15            return "redirect:/login";
     16        }
    1317        return "home";
    1418    }
     19
    1520    @GetMapping("/aboutUs")
    16     public String getSuccessPage(){
     21    public String getSuccessPage() {
    1722        return "/aboutUs";
    1823    }
Note: See TracChangeset for help on using the changeset viewer.