mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-11 02:10:11 +01:00
Merge pull request #1224 from Ludy87/fix_system_exit
Fix: Removes username validation check
This commit is contained in:
commit
7c0fd02126
@ -54,10 +54,8 @@ public class InitialSecuritySetup {
|
|||||||
&& !initialPassword.isEmpty()
|
&& !initialPassword.isEmpty()
|
||||||
&& !userService.findByUsernameIgnoreCase(initialUsername).isPresent()) {
|
&& !userService.findByUsernameIgnoreCase(initialUsername).isPresent()) {
|
||||||
try {
|
try {
|
||||||
if (userService.isUsernameValid(initialUsername)) {
|
userService.saveUser(initialUsername, initialPassword, Role.ADMIN.getRoleId());
|
||||||
userService.saveUser(initialUsername, initialPassword, Role.ADMIN.getRoleId());
|
logger.info("Admin user created: " + initialUsername);
|
||||||
logger.info("Admin user created: " + initialUsername);
|
|
||||||
}
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.error("Failed to initialize security setup", e);
|
logger.error("Failed to initialize security setup", e);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
@ -197,7 +197,13 @@ public class UserService implements UserServiceInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasUsers() {
|
public boolean hasUsers() {
|
||||||
return userRepository.count() > 0;
|
long userCount = userRepository.count();
|
||||||
|
if (userRepository
|
||||||
|
.findByUsernameIgnoreCase(Role.INTERNAL_API_USER.getRoleId())
|
||||||
|
.isPresent()) {
|
||||||
|
userCount -= 1;
|
||||||
|
}
|
||||||
|
return userCount > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateUserSettings(String username, Map<String, String> updates) {
|
public void updateUserSettings(String username, Map<String, String> updates) {
|
||||||
|
Loading…
Reference in New Issue
Block a user