feat(account): add project login page

This commit is contained in:
sechmachine
2026-08-15 01:00:46 +07:00
parent 8e786ba37b
commit a18d8e1d3d
5 changed files with 194 additions and 1 deletions
@@ -31,7 +31,7 @@ class SecurityConfiguration {
.permitAll()
.requestMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().authenticated())
.formLogin(form -> form.defaultSuccessUrl("/", true))
.formLogin(form -> form.loginPage("/login").defaultSuccessUrl("/", true))
.logout(logout -> logout.logoutSuccessUrl("/login?logout"))
.addFilterBefore(bootstrapAccessFilter, AuthorizationFilter.class)
.build();
@@ -0,0 +1,12 @@
package com.lab.labtimesheet.feature.account.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
class AuthenticationController {
@GetMapping("/login")
String login() {
return "accounts/login";
}
}
@@ -0,0 +1,19 @@
<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="utf-8"><title>Sign in · Lab Timesheet</title></head>
<body>
<main>
<h1>Sign in</h1>
<p th:if="${param.error}">Invalid email or password</p>
<p th:if="${param.logout}">You have signed out</p>
<p th:if="${param.activated}">Your account is active. Sign in to continue.</p>
<form method="post" th:action="@{/login}">
<label for="username">Email</label>
<input id="username" name="username" type="email" autocomplete="username" required autofocus>
<label for="password">Password</label>
<input id="password" name="password" type="password" autocomplete="current-password" required>
<button type="submit">Sign in</button>
</form>
</main>
</body>
</html>