#1298 allow cancel

This commit is contained in:
rootzoll 2020-06-29 21:38:20 +02:00
parent db83cbe6c4
commit b1d2ae4528
2 changed files with 23 additions and 19 deletions

View File

@ -354,7 +354,7 @@ to protect the seed words. Most users did not set this.
" 11 65
if [ $? -eq 1 ]; then
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /home/admin/.pass.tmp empty-allowed
passwordD=`sudo cat /home/admin/.pass.tmp`
sudo shred -u /home/admin/.pass.tmp 2>/dev/null
fi

View File

@ -326,26 +326,30 @@ elif [ "${abcd}" = "x" ]; then
exit 1
fi
# password zero
if [ ${#password1} -eq 0 ] && [ "$4" != "empty-allowed" ]; then
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
exit 1
fi
if [ "$4" != "empty-allowed" ]; then
# check that password does not contain bad characters
clearedResult=$(echo "${password1}" | tr -dc '[:alnum:]-.' | tr -d ' ')
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
exit 1
fi
# password zero
if [ ${#password1} -eq 0 ]; then
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
exit 1
fi
# check that password does not contain bad characters
clearedResult=$(echo "${password1}" | tr -dc '[:alnum:]-.' | tr -d ' ')
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
exit 1
fi
# password longer than 8
if [ ${#password1} -lt 8 ]; then
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
exit 1
fi
# password longer than 8
if [ ${#password1} -lt 8 ] && [ "$4" != "empty-allowed" ]; then
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3"
exit 1
fi
# store result is file