From 26a457f9d0f99365c1222caed58ccb67eed5ba13 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Sat, 18 May 2024 19:38:39 +0100 Subject: [PATCH] Update InitialSecuritySetup.java --- .../SPDF/config/security/InitialSecuritySetup.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java b/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java index 529dd4df..107b29d0 100644 --- a/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java +++ b/src/main/java/stirling/software/SPDF/config/security/InitialSecuritySetup.java @@ -39,12 +39,11 @@ public class InitialSecuritySetup { 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()); + + if (Files.exists(pathToFile)) { + logger.error( + "Invalid initial username provided , username can only contain letters, numbers and the following special characters @._+- or must be a valid email address."); + System.exit(1); } throw e; }