QPAT commited on
Commit
df01dd4
·
1 Parent(s): 2c7d657

Fix email can't login

Browse files
src/main/java/com/attendenceSystem/security/CustomUserDetailsService.java CHANGED
@@ -20,7 +20,7 @@ public class CustomUserDetailsService implements UserDetailsService {
20
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
21
 
22
  User user = userRepository
23
- .findByUsername(username)
24
  .orElseThrow(() -> new UsernameNotFoundException("Không tìm thấy User"));
25
 
26
  return CustomUserDetails.fromUser(user);
 
20
  public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
21
 
22
  User user = userRepository
23
+ .findByUsernameOrEmail(username, username)
24
  .orElseThrow(() -> new UsernameNotFoundException("Không tìm thấy User"));
25
 
26
  return CustomUserDetails.fromUser(user);
src/main/resources/static/css/account/account-list.css CHANGED
@@ -381,4 +381,76 @@ tbody tr:hover {
381
  .icon-btn {
382
  width: 100%;
383
  }
384
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  .icon-btn {
382
  width: 100%;
383
  }
384
+ }
385
+
386
+ /* ===================================
387
+ PAGINATION (đồng bộ với các trang khác)
388
+ =================================== */
389
+
390
+ .pagination {
391
+ padding: 20px 24px;
392
+ display: flex;
393
+ justify-content: center;
394
+ align-items: center;
395
+ gap: 12px;
396
+ flex-wrap: wrap;
397
+ }
398
+
399
+ .btn-pagination {
400
+ min-width: 120px;
401
+ height: 44px;
402
+ padding: 0 18px;
403
+ border: none;
404
+ border-radius: 12px;
405
+ cursor: pointer;
406
+ font-weight: 600;
407
+ color: white;
408
+ background: linear-gradient(to right, var(--indigo-06), var(--purple));
409
+ display: inline-flex;
410
+ align-items: center;
411
+ justify-content: center;
412
+ text-decoration: none;
413
+ transition: .25s;
414
+ }
415
+
416
+ .btn-pagination:hover {
417
+ transform: translateY(-2px);
418
+ }
419
+
420
+ .page-info {
421
+ display: flex;
422
+ align-items: center;
423
+ gap: 6px;
424
+ color: var(--text-light);
425
+ font-size: .95rem;
426
+ }
427
+
428
+ .page-link {
429
+ width: 40px;
430
+ height: 40px;
431
+ display: inline-flex;
432
+ align-items: center;
433
+ justify-content: center;
434
+ border-radius: 10px;
435
+ text-decoration: none;
436
+ font-weight: 600;
437
+ font-size: .95rem;
438
+ color: var(--text-light);
439
+ transition: .25s;
440
+ }
441
+
442
+ .page-link:hover {
443
+ background: var(--shadow-box);
444
+ color: white;
445
+ }
446
+
447
+ .page-link.active {
448
+ background: linear-gradient(to right, var(--indigo-06), var(--purple));
449
+ color: white;
450
+ }
451
+
452
+ @media(max-width:768px) {
453
+ .pagination {
454
+ flex-direction: column;
455
+ }
456
+ }
src/main/resources/templates/cms/account/account-list.html CHANGED
@@ -84,6 +84,28 @@
84
 
85
  </tbody>
86
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  </section>
88
  </main>
89
  <!-- FOOTER -->
 
84
 
85
  </tbody>
86
  </table>
87
+
88
+ <!-- PAGINATION -->
89
+ <div class="pagination" th:if="${users.totalPages > 1}">
90
+ <a th:if="${users.hasPrevious()}"
91
+ th:href="@{/admin/accounts(page=${users.number - 1})}"
92
+ class="btn btn-pagination">← Trước</a>
93
+
94
+ <span class="page-info">
95
+ <a th:each="i : ${#numbers.sequence(0, users.totalPages - 1)}"
96
+ th:if="${i == users.number}"
97
+ th:href="@{/admin/accounts(page=${i})}"
98
+ class="page-link active" th:text="${i + 1}">1</a>
99
+ <a th:each="i : ${#numbers.sequence(0, users.totalPages - 1)}"
100
+ th:unless="${i == users.number}"
101
+ th:href="@{/admin/accounts(page=${i})}"
102
+ class="page-link" th:text="${i + 1}">1</a>
103
+ </span>
104
+
105
+ <a th:if="${users.hasNext()}"
106
+ th:href="@{/admin/accounts(page=${users.number + 1})}"
107
+ class="btn btn-pagination">Sau →</a>
108
+ </div>
109
  </section>
110
  </main>
111
  <!-- FOOTER -->
src/main/resources/templates/cms/account/employee-list.html CHANGED
@@ -55,7 +55,6 @@
55
  <span>Tất cả phòng</span>
56
  <strong>0</strong>
57
  </button>
58
-
59
  <button class="room-chip" type="button" th:each="dept : ${departments}"
60
  th:attr="data-room=${dept.name()}">
61
  <span th:text="${dept.displayName}"></span>
@@ -193,7 +192,7 @@
193
  <div class="room-code-box">
194
  <span>Mã tham gia</span>
195
 
196
- <h1 id="roomCode">--------</h1>
197
 
198
  <button id="copyBtn">
199
  Sao chép mã
@@ -217,7 +216,7 @@
217
  window.serverRoomCodes = {};
218
 
219
  /*[# th:each="dept : ${T(com.attendenceSystem.module.user.entity.enums.Department).values()}"]*/
220
- window.serverRoomCodes[ /*[[${ dept.roomCode }]]*/ 'dummy_room' ] = /*[[${ dept.joinCode }]]*/ 'dummy_code';
221
  /*[/]*/
222
  </script>
223
  <script>
 
55
  <span>Tất cả phòng</span>
56
  <strong>0</strong>
57
  </button>
 
58
  <button class="room-chip" type="button" th:each="dept : ${departments}"
59
  th:attr="data-room=${dept.name()}">
60
  <span th:text="${dept.displayName}"></span>
 
192
  <div class="room-code-box">
193
  <span>Mã tham gia</span>
194
 
195
+ <h1 id="roomCode">--------</h1>
196
 
197
  <button id="copyBtn">
198
  Sao chép mã
 
216
  window.serverRoomCodes = {};
217
 
218
  /*[# th:each="dept : ${T(com.attendenceSystem.module.user.entity.enums.Department).values()}"]*/
219
+ window.serverRoomCodes[ /*[[${ dept.roomCode }]]*/ 'dummy_room'] = /*[[${ dept.joinCode }]]*/ 'dummy_code';
220
  /*[/]*/
221
  </script>
222
  <script>