Skip to content

Commit

Permalink
Merge pull request #53 from siwonKH/main
Browse files Browse the repository at this point in the history
Fix: check if already login
  • Loading branch information
siwonkh authored Jul 2, 2023
2 parents 282f0c6 + ebaf106 commit 1624a1f
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
Expand All @@ -13,8 +14,12 @@
@Controller
@RequestMapping("/login")
public class LoginController {
@GetMapping("")
public String loginPage(Model model, @RequestParam(value = "redirect", defaultValue = "/") String uri) {
@GetMapping
public String loginPage(HttpSession session, HttpServletResponse response, Model model, @RequestParam(value = "redirect", defaultValue = "/") String uri) throws IOException {
if (session.getAttribute("user") != null) {
response.sendRedirect("/");
}

model.addAttribute("redirect_uri", uri);
return "login";
}
Expand Down

0 comments on commit 1624a1f

Please sign in to comment.