mirror of
https://github.com/octoleo/Purse.git
synced 2024-12-29 12:32:39 +00:00
Fast fail if password file is missing.
This commit is contained in:
parent
f42437388d
commit
09adcb0b95
@ -36,7 +36,9 @@ The script and `pwd.sh.safe` encrypted file can be safely shared between machine
|
|||||||
|
|
||||||
A sample `gpg.conf` configuration file is provided for your consideration.
|
A sample `gpg.conf` configuration file is provided for your consideration.
|
||||||
|
|
||||||
# Alternatives
|
# Recommended software
|
||||||
|
|
||||||
[Pass: the standard unix password manager](http://www.passwordstore.org/)
|
[Pass: the standard unix password manager](http://www.passwordstore.org/)
|
||||||
|
|
||||||
|
[sf-pwgen: generates passwords using OS X Security framework](https://github.com/anders/pwgen)
|
||||||
|
|
||||||
|
18
pwd.sh
18
pwd.sh
@ -68,25 +68,25 @@ encrypt () {
|
|||||||
read_pass () {
|
read_pass () {
|
||||||
# Read a password from safe.
|
# Read a password from safe.
|
||||||
|
|
||||||
|
if [[ ! -s ${safe} ]] ; then
|
||||||
|
fail "No passwords found"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z "${2+x}" ]] ; then
|
if [[ -z "${2+x}" ]] ; then
|
||||||
read -p "
|
read -p "
|
||||||
Username to read? (default: all) " username
|
Username to read? (default: all) " username
|
||||||
else
|
else
|
||||||
username="${2}"
|
username="${2}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${username} || ${username} == "all" ]] ; then
|
if [[ -z ${username} || ${username} == "all" ]] ; then
|
||||||
username=""
|
username=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -s ${safe} ]] ; then
|
get_pass "
|
||||||
fail "No passwords found"
|
|
||||||
else
|
|
||||||
get_pass "
|
|
||||||
Enter password to unlock ${safe}: "
|
Enter password to unlock ${safe}: "
|
||||||
printf "\n\n"
|
printf "\n\n"
|
||||||
decrypt ${password} ${safe} | grep " ${username}" || fail "Decryption failed"
|
decrypt ${password} ${safe} | grep " ${username}" || fail "Decryption failed"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ create_username () {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${4+x}" || ! "${4}" =~ ^([qQ])$ ]] ; then
|
if [[ -z "${4+x}" || ! "${4}" =~ ^([qQ])$ ]] ; then
|
||||||
echo "
|
echo "
|
||||||
Password: ${userpass}"
|
Password: ${userpass}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user