passwords can be changed in wizard

This commit is contained in:
Luke 2018-02-13 18:44:53 -07:00
parent caecb19561
commit 5cb61f78d6
2 changed files with 17 additions and 10 deletions

View File

@ -47,4 +47,3 @@ Mail is stored in `~/.mail`. mutt configs and caches for each account are in `~/
## Todo
* Expand the list of server information in `domains.csv`.
* Add an option to update passwords.

View File

@ -2,6 +2,13 @@
muttdir="$HOME/.config/mutt/"
changePassword() { \
gpgemail=$( dialog --title "Luke's mutt/offlineIMAP password wizard" --inputbox "Insert the email address with which you originally created your GPG key pair. This is NOT necessarily the email you want to configure." 10 60 3>&1 1>&2 2>&3 3>&- )
dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the new password for the \"$1\" account." 10 60 2> /tmp/$1
gpg2 -r $gpgemail --encrypt /tmp/$1 || (dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG1 and you thus need to symlink /usr/bin/gpg2 to /usr/bin/gpg." 7 60 && break)
shred -u /tmp/$1
mv /tmp/$1.gpg ~/.config/mutt/credentials/ ;}
detectWarning() { \
dialog --title "Mailbox detect requirement" --yesno "In order for the mailbox detection system to work, you must have
@ -55,7 +62,7 @@ inventory() { \
accounts+=($n "$s" off)
done < /tmp/numbered
choices=$(dialog --separate-output --checklist "Choose an email account." 22 76 16 "${accounts[@]}" 2>&1 >/dev/tty)
choices=$(dialog --separate-output --checklist "Choose an email account." 15 40 16 "${accounts[@]}" 2>&1 >/dev/tty)
if [ -z "$choices" ];
then
@ -171,24 +178,25 @@ wipe () { rm $HOME/.offlineimaprc
while : ;
do
choice=$(dialog --title "Luke's mutt/offlineIMAP wizard" \
--menu "What would you like to do?" 13 45 6 \
--menu "What would you like to do?" 14 45 7 \
0 "List all email accounts configured." \
1 "Add an email account." \
2 "Auto-detect mailboxes for an account." \
3 "Remove an email account." \
4 "Remove all email accounts." \
5 "Exit this wizard." \
3 "Change an account's password." \
4 "Remove an email account." \
5 "Remove all email accounts." \
6 "Exit this wizard." \
3>&1 1>&2 2>&3 3>&1 )
case $choice in
0) dialog --title "Accounts detected" --msgbox "The following accounts have been detected:
$(grep ~/.offlineimaprc -e "^accounts =" | sed 's/accounts =//g')
" 6 60;;
1) addChosen;;
2) detectWarning && inventory && for i in $userchoices; do detectMailboxes $i ; done && detectSuccess;;
3) inventory && for i in $userchoices; do removeAccount $i ; done;;
4) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;;
5) clear && break
3) inventory && for i in $userchoices; do changePassword $i ; done;;
4) inventory && for i in $userchoices; do removeAccount $i ; done;;
5) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;;
6) clear && break
esac
done