Added login page
This commit is contained in:
parent
4cf91146db
commit
1f43e53a83
@ -27,6 +27,13 @@ class BaseController
|
||||
return "landing"
|
||||
}
|
||||
|
||||
@GetMapping("/login")
|
||||
fun login(model: Model, error: String?, logout: String?): String? {
|
||||
if (error != null) model.addAttribute("error", "Your username and password is invalid.")
|
||||
if (logout != null) model.addAttribute("message", "You have been logged out successfully.")
|
||||
return "login"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Controller
|
||||
|
47
src/main/resources/templates/login.html
Normal file
47
src/main/resources/templates/login.html
Normal file
@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta th:replace="fragments :: header"/>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row justify-content-center mt-3">
|
||||
<div class="col text-center">
|
||||
<h2 class="display-3">Welcome back</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center mt-3">
|
||||
<div class="col-8 text-center">
|
||||
<form class="form-sign_in" method="POST" th:action="@{/login}">
|
||||
<div class="form-group mt-3">
|
||||
<span th:text="${message}"></span>
|
||||
<div class="form-floating mb-3">
|
||||
<input autofocus class="form-control form-control-lg" id="username" name="username" type="text">
|
||||
<label for="username">Username</label>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" id="password" name="password" type="password">
|
||||
<label for="password">Password</label>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<span class="has-error text-danger" th:text="${error}"></span>
|
||||
<input name="${_csrf.parameterName}" type="hidden" value="${_csrf.token}"/>
|
||||
|
||||
<div>
|
||||
<button class="btn btn-lg btn-primary btn-block" type="submit">Log In</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-center mt-3">
|
||||
<div class="col text-center">
|
||||
<a class="btn btn-secondary btn-lg" href="/" role="button">Home</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user