From 769c077bdbb1dc73419d0b0af632b3d24beb75b8 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 14 Jan 2022 23:25:50 -0600 Subject: [PATCH] Password validation --- startup.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/startup.sh b/startup.sh index 1370106..fbb231b 100644 --- a/startup.sh +++ b/startup.sh @@ -140,9 +140,20 @@ drivessd userinfo () { read -p "Please enter your username: " username set_option USERNAME ${username,,} # convert to lower case as in issue #109 -echo -ne "Please enter your password: \n" -read -s password # read password without echo -set_option PASSWORD $password +while true; do + echo -ne "Please enter your password: \n" + read -s password # read password without echo + + echo -ne "Please repeat your password: \n" + read -s password2 # read password without echo + + if [ "$password" = "$password2" ]; then + set_option PASSWORD $password + break + else + echo -e "\nPasswords do not match. Please try again. \n" + fi +done read -rep "Please enter your hostname: " nameofmachine set_option NAME_OF_MACHINE $nameofmachine }