diff --git a/src/main/java/com/gcc/crslogs/controller/MainController.java b/src/main/java/com/gcc/crslogs/controller/MainController.java index 86a8289..9e2e643 100644 --- a/src/main/java/com/gcc/crslogs/controller/MainController.java +++ b/src/main/java/com/gcc/crslogs/controller/MainController.java @@ -13,15 +13,17 @@ import jakarta.servlet.http.HttpSession; @RequestMapping(value = { "/crs" }) public class MainController { - @GetMapping(value = { "", "/", "/birthloginpage","/deathloginpage" }) - - public String requestbirthform(Model model) { - return "modules/crslogspages/birthloginpage"; + @GetMapping("/birthloginpage") + public String requestBirthForm(Model model) { + return "modules/crslogspages/birthloginpage"; } - public String requestdeathform(Model model) { - return "modules/crslogspages/deathloginpage"; + + @GetMapping("/deathloginpage") + public String requestDeathForm(Model model) { + return "modules/crslogspages/deathloginpage"; } + /*@GetMapping("/birthanddeath") public String birthform(HttpServletRequest request, Model model) { HttpSession session = request.getSession(); @@ -42,19 +44,19 @@ public class MainController { @GetMapping("/birth") public String birthPage(HttpServletRequest request, Model model) { HttpSession session = request.getSession(); - session.setMaxInactiveInterval(10 * 60); + String username = (String) session.getAttribute("userName"); if (username == null || username.isEmpty()) { return "modules/crslogspages/birthloginpage"; } return "modules/crslogspages/birth"; } - + @GetMapping("/death") public String deathPage(HttpServletRequest request, Model model) { HttpSession session = request.getSession(); - session.setMaxInactiveInterval(10 * 60); + String username = (String) session.getAttribute("userName"); if (username == null || username.isEmpty()) { return "modules/crslogspages/deathloginpage"; @@ -67,7 +69,7 @@ public class MainController { @GetMapping("/birthlogout") public String logoutbirthForm(HttpServletRequest request) { HttpSession session = request.getSession(); - session.setMaxInactiveInterval(10 * 60); + session.invalidate(); return "modules/crslogspages/birth"; diff --git a/src/main/resources/templates/modules/crslogspages/birth.html b/src/main/resources/templates/modules/crslogspages/birth.html index 3a4451b..92c7fec 100644 --- a/src/main/resources/templates/modules/crslogspages/birth.html +++ b/src/main/resources/templates/modules/crslogspages/birth.html @@ -770,6 +770,7 @@ body { // Redirect after 60 seconds (1 minute) of inactivity let timeoutDuration = 10 * 60 * 1000; // 60 seconds +//let timeoutDuration = 1 * 60 * 1000; // 1 minute = 60,000 ms let timeout; @@ -777,7 +778,7 @@ body { clearTimeout(timeout); timeout = setTimeout(() => { // Optionally check if session is still active via an API - window.location.href = "/crs/loginpage"; + window.location.href = "/crs/birthloginpage"; }, timeoutDuration); } diff --git a/src/main/resources/templates/modules/crslogspages/death.html b/src/main/resources/templates/modules/crslogspages/death.html index 8db6cdd..2626b7c 100644 --- a/src/main/resources/templates/modules/crslogspages/death.html +++ b/src/main/resources/templates/modules/crslogspages/death.html @@ -249,7 +249,7 @@ body { .nav-link.active { color: white; - background-color: #007bff; + background-color: #006680; border-radius: 5px; padding: 5px 10px; font-weight: bold; @@ -284,8 +284,8 @@ body { transition: background-color 0.3s ease; } -.nav-link:hover, -.nav-link.active { +.nav-link:hover + { background-color: #006680; color: #fff; } @@ -490,7 +490,7 @@ body { @@ -770,6 +770,9 @@ body { // Redirect after 60 seconds (1 minute) of inactivity let timeoutDuration = 10 * 60 * 1000; // 60 seconds + + // 1 minute = 60,000 ms + let timeout; @@ -777,7 +780,7 @@ body { clearTimeout(timeout); timeout = setTimeout(() => { // Optionally check if session is still active via an API - window.location.href = "/crs/loginpage"; + window.location.href = "/crs/deathloginpage"; }, timeoutDuration); }