mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-11 02:10:11 +01:00
Update InitialSecuritySetup.java
This commit is contained in:
parent
811c19e00d
commit
dcf13e9ade
@ -33,21 +33,21 @@ public class InitialSecuritySetup {
|
||||
applicationProperties.getSecurity().getInitialLogin().getUsername();
|
||||
String initialPassword =
|
||||
applicationProperties.getSecurity().getInitialLogin().getPassword();
|
||||
try {
|
||||
// https://github.com/Stirling-Tools/Stirling-PDF/issues/976
|
||||
userService.isUsernameValidWithReturn(initialUsername);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Path pathToFile = Paths.get("configs/settings.yml");
|
||||
try {
|
||||
if (Files.exists(pathToFile)) {
|
||||
Files.delete(pathToFile);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
if (initialUsername != null && initialPassword != null) {
|
||||
try {
|
||||
// https://github.com/Stirling-Tools/Stirling-PDF/issues/976
|
||||
userService.isUsernameValidWithReturn(initialUsername);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Path pathToFile = Paths.get("configs/settings.yml");
|
||||
try {
|
||||
if (Files.exists(pathToFile)) {
|
||||
Files.delete(pathToFile);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.info(ex.getMessage());
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
userService.saveUser(initialUsername, initialPassword, Role.ADMIN.getRoleId());
|
||||
} else {
|
||||
initialUsername = "admin";
|
||||
|
Loading…
Reference in New Issue
Block a user