Check password by entering it twice and comparing

This commit is contained in:
stojshic 2022-01-14 23:45:55 +01:00
parent 5721dbc578
commit f7cd4cf166
1 changed files with 14 additions and 4 deletions

View File

@ -145,9 +145,19 @@ set_option DISK $option
userinfo () { userinfo () {
read -p "Please enter your username: " username read -p "Please enter your username: " username
set_option USERNAME ${username,,} # convert to lower case as in issue #109 set_option USERNAME ${username,,} # convert to lower case as in issue #109
while true; do
echo -ne "Please enter your password: \n" echo -ne "Please enter your password: \n"
read -s password # read password without echo read -s password # read password without echo
set_option PASSWORD $password set_option PASSWORD $password
echo -ne "Please repeat your password: \n"
read -s password2 # read password without echo
set_option PASSWORD2 $password2
[ "$password" = "$password2" ] && break
echo "Please try again"
done
read -rep "Please enter your hostname: " nameofmachine read -rep "Please enter your hostname: " nameofmachine
set_option nameofmachine $nameofmachine set_option nameofmachine $nameofmachine
} }