Merge pull request #1224 from Ludy87/fix_system_exit
Fix: Removes username validation check
This commit is contained in:
commit
7c0fd02126
2 changed files with 9 additions and 5 deletions
|
@ -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 a new issue