Better random passwords

This commit is contained in:
krisdoodle45 2021-09-28 21:30:49 +02:00 committed by GitHub
parent 92336ad746
commit 8f28de8865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,7 +52,7 @@ addPassword() { \
[ -z "$name" ] && exit
case "$(printf "Random password\\nManual password" | dmenu -i -p "Passwords")" in
"Random password") addPass=$(tr -dc '[:print:]' < /dev/urandom | tr -d ' ' | head -c $(printf "12\\n32\\n128" | dmenu -i -p "How many characters?")) ;;
"Random password") addPass=$(tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c $(printf "12\\n32\\n128" | dmenu -i -p "How many characters?") ; echo) ;;
"Manual password") addPass=$(dmenu -i -P -p "Enter a password") ;;
* ) exit
esac
@ -64,15 +64,15 @@ addPassword() { \
}
removePassword() { \
name="$(pass | printf '%s\n' "${password_files[@]}" | dmenu -i -p "Passwords")"
name="$(pass | echo "$password_files" | dmenu -i -p "Passwords")"
[ -z "$name" ] && exit
sure="$(printf "No\\nYes" | dmenu -i -sb "#ac3333" -sf "#111111" -nf "#dddddd" -nb "#111111" -p "Are you sure?")"
if [ $sure = "Yes" ]
then
notify-send "❎ Password for $name removed!"
pass rm "$name" -f
notify-send "❎ Password for $name removed!"
else
notify-send "Canceled"
fi