updated bw related scripts to deal with user exiting
This commit is contained in:
parent
fb5725c20e
commit
b95f3e1270
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
##
|
||||
# Depends: zenity
|
||||
# Depends: zenity, bw (bitwarden-cli), notify-send
|
||||
#
|
||||
# Generates bw session key and saves it in tmp file where only current user has permissions
|
||||
#
|
||||
@ -19,4 +19,6 @@ touch $loc -f
|
||||
|
||||
chmod 600 $loc
|
||||
|
||||
echo "$session" > /tmp/bw-session
|
||||
echo "$session" > /tmp/bw-session
|
||||
|
||||
notify-send "Your bitwarden vault has been unlocked until next reboot."
|
||||
@ -21,6 +21,11 @@ options=$(echo "$items" | jq ".[].name" | sed 's/"//g')
|
||||
|
||||
entry=$(echo "$options" | dmenu -i -p "Which entry?" $1)
|
||||
|
||||
if [ -z $entry ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! password=$(bw get password "$entry" --session "$session")
|
||||
then
|
||||
|
||||
@ -31,6 +36,11 @@ then
|
||||
|
||||
user=$(echo "$user_options" | jq '.[].login.username' | dmenu -i -p "Which account?" $1 | sed 's/"//g')
|
||||
|
||||
if [ -z $user ]
|
||||
then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
pass=$(echo "$user_options" | jq '.[] | select(.login.username == "'"$user"'") | .login.password' | sed 's/"//g')
|
||||
|
||||
echo "$pass" | xclip -sel clip
|
||||
@ -38,3 +48,5 @@ then
|
||||
else
|
||||
echo "$password" | xclip -sel clip
|
||||
fi
|
||||
|
||||
notify-send "password for $entry probably copied to clipbroad"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user