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()); .anyRequest().authenticated());
httpSecurity.formLogin(formLogin -> formLogin httpSecurity.formLogin(formLogin -> formLogin
.loginPage(Constants.LOGIN_URL)); .loginPage(Constants.LOGIN_URL)
.defaultSuccessUrl("/news", true));
httpSecurity.rememberMe(rememberMe -> rememberMe.key("uniqueAndSecret")); httpSecurity.rememberMe(rememberMe -> rememberMe.key("uniqueAndSecret"));

View File

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

View File

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

View File

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

View File

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