From 92c647bca1b7fd9643ba9c7997400d444b2584d8 Mon Sep 17 00:00:00 2001 From: p3t4rc <147734357+p3t4rc@users.noreply.github.com> Date: Tue, 29 Apr 2025 14:58:37 +0200 Subject: [PATCH] Update install.sh custom pw --- install.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 5606e59c..a2d2cdc8 100644 --- a/install.sh +++ b/install.sh @@ -1763,11 +1763,16 @@ create_admin_and_show_logins_success_message() { fi - if [ "$SET_ADMIN_PASSWORD" = true ]; then - new_password="${custom_password}" - else - new_password=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16) - fi + if [ "$SET_ADMIN_PASSWORD" = true ]; then + if [[ "$custom_password" =~ ^[A-Za-z0-9]{6,16}$ ]]; then + new_password="${custom_password}" + else + echo "Warning: custom_password is invalid (must be alphanumeric and 6–16 characters). Generating a secure password." + new_password=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16) + fi + else + new_password=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16) + fi display_admin_status_and_logins() {