Browse Source

improved password dialog

#146
rootzoll 6 years ago
parent
commit
3aad2dcb7a
  1. 57
      home.admin/20initDialog.sh

57
home.admin/20initDialog.sh

@ -22,8 +22,12 @@ sed -i "s/^alias=.*/alias=${result}/g" /home/admin/assets/lnd.${network}.conf
# work around - because without a reboot the hostname seems not updates in the whole system # work around - because without a reboot the hostname seems not updates in the whole system
echo $result > /home/admin/.hostname echo $result > /home/admin/.hostname
# show password info dialog passwordValid=0
dialog --backtitle "RaspiBlitz - Setup" --msgbox "RaspiBlitz uses 4 different passwords. result=""
while [passwordValid -eq 0]
do
# show password info dialog
dialog --backtitle "RaspiBlitz - Setup" --msgbox "RaspiBlitz uses 4 different passwords.
Referenced as password A, B, C and D. Referenced as password A, B, C and D.
A) Master User Password A) Master User Password
@ -34,31 +38,36 @@ D) LND Seed Password
Choose now 4 new passwords - all min 8 chars, Choose now 4 new passwords - all min 8 chars,
no spaces and only special characters - or . no spaces and only special characters - or .
Write them down & store them in a safe place. Write them down & store them in a safe place.
" 14 52 " 15 52
# ask user for new password A # ask user for new password A
dialog --backtitle "RaspiBlitz - Setup"\ dialog --backtitle "RaspiBlitz - Setup"\
--inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp --inputbox "Please enter your Master/Admin Password A:\n!!! This is new password to login per SSH !!!" 10 52 2>$_temp
# get user input # get user input
result=$( cat $_temp ) result=$( cat $_temp )
shred $_temp shred $_temp
passwordValid=1
clearedResult=$(echo '${result}' | tr -dc '[:alnum:]-.')
if [ ${#clearedResult} != ${#result} ]; then clearedResult=$(echo '${result}' | tr -dc '[:alnum:]-.')
clear if [ ${#clearedResult} != ${#result} ]; then
echo "FAIL - Password contained not allowed chars" clear
echo "Please restart with ./00mainMenu.sh" echo "FAIL - Password contained not allowed chars"
exit 1 echo "Press ENTER to continue .."
fi ready key
passwordValid=0
# check input (check for more later) fi
if [ ${#result} -eq 0 ]; then
clear # check input (check for more later)
echo "FAIL - Password cannot be empty" if [ ${#result} -eq 0 ]; then
echo "Please restart with ./00mainMenu.sh" clear
exit 1 echo "FAIL - Password cannot be empty"
fi echo "Press ENTER to continue .."
ready key
passwordValid=0
fi
done
# change user passwords and then change hostname # change user passwords and then change hostname
echo "pi:$result" | sudo chpasswd echo "pi:$result" | sudo chpasswd

Loading…
Cancel
Save