Browse Source

improved password dialog

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

19
home.admin/20initDialog.sh

@ -22,6 +22,10 @@ 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
passwordValid=0
result=""
while [passwordValid -eq 0]
do
# show password info dialog # show password info dialog
dialog --backtitle "RaspiBlitz - Setup" --msgbox "RaspiBlitz uses 4 different passwords. 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.
@ -34,7 +38,7 @@ 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"\
@ -43,23 +47,28 @@ dialog --backtitle "RaspiBlitz - Setup"\
# get user input # get user input
result=$( cat $_temp ) result=$( cat $_temp )
shred $_temp shred $_temp
passwordValid=1
clearedResult=$(echo '${result}' | tr -dc '[:alnum:]-.') clearedResult=$(echo '${result}' | tr -dc '[:alnum:]-.')
if [ ${#clearedResult} != ${#result} ]; then if [ ${#clearedResult} != ${#result} ]; then
clear clear
echo "FAIL - Password contained not allowed chars" echo "FAIL - Password contained not allowed chars"
echo "Please restart with ./00mainMenu.sh" echo "Press ENTER to continue .."
exit 1 ready key
passwordValid=0
fi fi
# check input (check for more later) # check input (check for more later)
if [ ${#result} -eq 0 ]; then if [ ${#result} -eq 0 ]; then
clear clear
echo "FAIL - Password cannot be empty" echo "FAIL - Password cannot be empty"
echo "Please restart with ./00mainMenu.sh" echo "Press ENTER to continue .."
exit 1 ready key
passwordValid=0
fi 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
echo "root:$result" | sudo chpasswd echo "root:$result" | sudo chpasswd

Loading…
Cancel
Save