Compare commits

...

3 Commits

Author SHA1 Message Date
DyCTaTOR
e2d54386c9 еще одно промежуточное 2024-06-05 00:23:11 +04:00
DyCTaTOR
4c81ef4515 Промежуточное 2024-06-05 00:22:34 +04:00
DyCTaTOR
845d28ad0a Неправильно сохраняет юзеров 2024-06-05 00:22:12 +04:00
7 changed files with 3387 additions and 33 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,8 @@ public class SecurityConfiguration {
.anyRequest().authenticated());
httpSecurity.formLogin(formLogin -> formLogin
.loginPage(Constants.LOGIN_URL));
.loginPage(Constants.LOGIN_URL)
.defaultSuccessUrl("/news", true));
httpSecurity.rememberMe(rememberMe -> rememberMe.key("uniqueAndSecret"));

View File

@ -73,5 +73,4 @@ public class EntrysDataSignupController {
userService.create(toEntity(user));
return Constants.REDIRECT_VIEW + Constants.LOGIN_URL + "?signup";
}
}

View File

@ -16,11 +16,11 @@ import jakarta.persistence.Table;
public class EntrysDataEntity extends BaseEntity {
@Column(nullable = false, unique = true, length = 30)
private String login;
@Column(nullable = false, length = 25)
@Column(nullable = false, length = 60)
private String password;
private EntrysDataRole role;
@ManyToOne
@JoinColumn(name = "departmentId", nullable = false)
@JoinColumn(name = "departmentId", nullable = true)
private DepartmentEntity department;
public EntrysDataEntity() {

View File

@ -16,35 +16,40 @@
<body class="h-100 d-flex flex-column">
<nav class="navbar navbar-expand-md my-navbar" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand" href="/">
<a class="navbar-brand" href="/news">
<i></i>
UlSTU
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar"
aria-controls="main-navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="main-navbar">
<ul class="navbar-nav me-auto link" th:with="activeLink=${#objects.nullSafe(servletPath, '')}">
<a class="nav-link" href="/news" th:classappend="${activeLink.startsWith('/news') ? 'active' : ''}">
Новости
</a>
<a class="nav-link" href="/directions"
th:classappend="${activeLink.startsWith('/directions') ? 'active' : ''}">
Направления
</a>
<a class="nav-link" href="/departments"
th:classappend="${activeLink.startsWith('/departments') ? 'active' : ''}">
Кафедры
</a>
<a class="nav-link" href="/users"
th:classappend="${activeLink.startsWith('/users') ? 'active' : ''}">
Пользователи
</a>
</ul>
<ul class="navbar-nav">
</ul>
</div>
<th:block sec:authorize="isAuthenticated()" th:with="userName=${#authentication.name}">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#main-navbar"
aria-controls="main-navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="main-navbar">
<ul class="navbar-nav me-auto link" th:with="activeLink=${#objects.nullSafe(servletPath, '')}">
<a class="nav-link" href="/news"
th:classappend="${activeLink.startsWith('/news') ? 'active' : ''}">
Новости
</a>
<a class="nav-link" href="/directions"
th:classappend="${activeLink.startsWith('/directions') ? 'active' : ''}">
Направления
</a>
<th:block sec:authorize="hasRole('ADMIN')">
<a class="nav-link" href="/admin/departments"
th:classappend="${activeLink.startsWith('/departments') ? 'active' : ''}">
Кафедры
</a>
<a class="nav-link" href="/admin/users"
th:classappend="${activeLink.startsWith('/users') ? 'active' : ''}">
Пользователи
</a>
</th:block>
</ul>
<ul class="navbar-nav">
</ul>
</div>
</th:block>
</div>
</nav>
<main class="container-fluid p-2" layout:fragment="content">

View File

@ -43,7 +43,7 @@
<h2 th:case="0">Данные отсутствуют</h2>
<th:block th:case="*">
<div>
<a th:href="@{/news/edit/(page=${page})}" class="btn btn-danger mt-1">Добавить новость</a>
<a th:href="@{/admin/news/edit/(page=${page})}" class="btn btn-danger mt-1">Добавить новость</a>
</div>
<div class="row">
<div class="col mt-4 colStyle" th:each="newItem : ${items}">
@ -56,12 +56,12 @@
</span>
</div>
<div class="forButtons">
<form th:action="@{/news/edit/{id}(id=${newItem.id})}" method="get">
<form th:action="@{/admin/news/edit/{id}(id=${newItem.id})}" method="get">
<input type="hidden" th:name="page" th:value="${page}">
<button type="submit" class="btn btn-link button-link">
<i class="fa fa-edit">Изменить</i>
</form>
<form th:action="@{/news/delete/{id}(id=${newItem.id})}" method="post">
<form th:action="@{/admin/news/delete/{id}(id=${newItem.id})}" method="post">
<input type="hidden" th:name="page" th:value="${page}">
<button type="submit" class="btn btn-link button-link"
onclick="return confirm('Вы уверены?')">