Skip to content

Commit

Permalink
moved FORCE flag logic to outside bw_login
Browse files Browse the repository at this point in the history
  • Loading branch information
cjvirtucio87 committed Mar 26, 2022
1 parent c3688af commit 8f7481a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bwsh/bin/bw_session.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ function bw_creds {

function bw_login {
local session_file="${HOME}/.secrets/bitwarden/session"
if [[ -v FORCE ]]; then
rm -f "${session_file}"
bw logout
fi

if bw login --check "$(get_username)" &>/dev/null; then
log "already logged in"
if [[ -f "${session_file}" ]]; then
Expand Down Expand Up @@ -106,6 +101,12 @@ function main {
bw_login
}

if [[ -v FORCE ]]; then
unset BW_SESSION
rm -f "${HOME}/.secrets/bitwarden/session"
bw logout
fi

if (return 0 &>/dev/null); then
if [[ -v BW_SESSION ]]; then
log "already logged in"
Expand Down

0 comments on commit 8f7481a

Please sign in to comment.