diff --git a/update-setup.sh b/update-setup.sh index 010585e..15fa6d5 100644 --- a/update-setup.sh +++ b/update-setup.sh @@ -494,6 +494,17 @@ EOL fi fi + # Strip the "Digest: " prefix if present + password_hash=$(echo "$password_hash" | sed 's/^Digest: //') + + # Verify hash format + if [[ ! "$password_hash" =~ ^\$argon2id.*$ ]]; then + echo -e "${RED}Error: Generated hash does not have the expected format. Actual value:${NC}" + echo -e "${YELLOW}$password_hash${NC}" + echo -e "${RED}Skipping user creation.${NC}" + continue + fi + echo -e "${GREEN}Password hash generated successfully.${NC}" # Check if user already exists in the file and update