Enforcing Username Uniqueness (#906)
* Enforcing Username Uniqueness Changes in UserService.java: Added a new method findByUsername to allow searching for usernames regardless of case sensitivity. Added a new method isUsernameValid to validate the username. Changes in UserController.java: Updated the changeUsername method to ensure the new username is valid before changing it. Updated the editUser method to ensure the new username is unique and valid. Changes in UserRepository.java: Added a custom JPQL query to search for usernames regardless of case sensitivity. Changes in HTML templates (account.html and addUsers.html): Error messages are displayed if a username is invalid or already exists. * JPAs auto
This commit is contained in:
@@ -30,6 +30,9 @@
|
||||
<div th:if="${param.messageType[0] == 'usernameExists'}" class="alert alert-danger">
|
||||
<span th:text="#{usernameExistsMessage}">Default message if not found</span>
|
||||
</div>
|
||||
<div th:if="${param.messageType[0] == 'invalidUsername'}" class="alert alert-danger">
|
||||
<span th:text="#{invalidUsernameMessage}">Default message if not found</span>
|
||||
</div>
|
||||
</th:block>
|
||||
<!-- At the top of the user settings -->
|
||||
<h3 class="text-center"><span th:text="#{welcome} + ' ' + ${username}">User</span>!</h3>
|
||||
|
||||
Reference in New Issue
Block a user