авторизация #4
BIN
data/db.mv.db
BIN
data/db.mv.db
Binary file not shown.
@ -21,6 +21,7 @@ public class MvcConfiguration implements WebMvcConfigurer {
|
|||||||
@Override
|
@Override
|
||||||
public void addViewControllers(ViewControllerRegistry registry) {
|
public void addViewControllers(ViewControllerRegistry registry) {
|
||||||
registry.addViewController("/login");
|
registry.addViewController("/login");
|
||||||
|
registry.addViewController("/loginError");
|
||||||
registry.addViewController("/index");
|
registry.addViewController("/index");
|
||||||
registry.addViewController("/admin");
|
registry.addViewController("/admin");
|
||||||
registry.addViewController("/editNews");
|
registry.addViewController("/editNews");
|
||||||
|
@ -53,6 +53,7 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
|
|||||||
.and()
|
.and()
|
||||||
.formLogin()
|
.formLogin()
|
||||||
.loginPage("/login")
|
.loginPage("/login")
|
||||||
|
.failureUrl("/loginError")
|
||||||
.successHandler(authenticationSuccessHandler)
|
.successHandler(authenticationSuccessHandler)
|
||||||
.permitAll()
|
.permitAll()
|
||||||
.and()
|
.and()
|
||||||
|
@ -13,11 +13,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="container" layout:fragment="content">
|
<div class="container" layout:fragment="content">
|
||||||
<ul class="nav nav-tabs">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" href="#signin">Вход в систему</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div id="signin" class="tab-pane active">
|
<div id="signin" class="tab-pane active">
|
||||||
<form th:action="@{/login}" method="post" class="margined-top-10">
|
<form th:action="@{/login}" method="post" class="margined-top-10">
|
||||||
@ -30,12 +25,7 @@
|
|||||||
<input type="password" name="password" id="password" class="form-control"
|
<input type="password" name="password" id="password" class="form-control"
|
||||||
placeholder="Пароль" required="true"/>
|
placeholder="Пароль" required="true"/>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-success btn-block">Войти</button>
|
<button type="submit" class="btn btn-outline-dark btn-block">Войти</button>
|
||||||
<div class="form-group">
|
|
||||||
<small class="form-text text-muted">
|
|
||||||
<a href="/resetRequest">Забыли пароль?</a>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
40
src/main/resources/templates/loginError.html
Normal file
40
src/main/resources/templates/loginError.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:th="http://www.thymeleaf.org"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav layout:fragment="navbar">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<a class="navbar-brand" href="/"><span class="ui-menuitem-text"><i
|
||||||
|
class="fa fa-plane fa-4" aria-hidden="true"></i> Balance</span></a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<div class="container" layout:fragment="content">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<ul id="messages" class="feedback-panel">
|
||||||
|
<div class="alert alert-danger" role="alert">Ошибка входа</div>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div id="signin" class="tab-pane active">
|
||||||
|
<form th:action="@{/login}" method="post" class="margined-top-10">
|
||||||
|
<fieldset>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" name="username" id="username" class="form-control"
|
||||||
|
placeholder="Логин" required="true" autofocus="true"/>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="password" name="password" id="password" class="form-control"
|
||||||
|
placeholder="Пароль" required="true"/>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-outline-dark btn-block">Войти</button>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user