diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-18 13:58:11 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-18 13:58:11 +0200 |
| commit | 07b5e5890fedbf71a1503f984dfbc2baa872223c (patch) | |
| tree | 493c124afb2421dde111ef6fb62d601a6dc8dae0 /scripts | |
| parent | 71f45261b028c2065fcae96376aa57b05f1e3e34 (diff) | |
| download | bokf-07b5e5890fedbf71a1503f984dfbc2baa872223c.tar.gz bokf-07b5e5890fedbf71a1503f984dfbc2baa872223c.zip | |
scripts: bokftui-bw exports the item's login username
Password-kind items only exported BOKFD_PASSWORD, so the TUI fell back
to the username saved in tui.conf (admin) and failed with AUTH_FAILED
when switching accounts. The item's login username now wins unless the
caller set BOKFD_USER explicitly.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/bokftui-bw | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/bokftui-bw b/scripts/bokftui-bw index 7742909..7bc07fe 100755 --- a/scripts/bokftui-bw +++ b/scripts/bokftui-bw @@ -105,6 +105,8 @@ elif command -v bw >/dev/null 2>&1; then secret=$(printf '%s' "$items" | jq -r --arg id "$id" \ '.[] | select(.id == $id) | .login.password') fi + item_user=$(printf '%s' "$items" | jq -r --arg id "$id" \ + '.[] | select(.id == $id) | (.login.username // "")') else echo "bokftui-bw: install rbw or the Bitwarden CLI (bw)" >&2 exit 1 @@ -123,6 +125,10 @@ case "$kind" in password) BOKFD_PASSWORD="$secret" export BOKFD_PASSWORD + if [ -n "${item_user:-}" ] && [ -z "${BOKFD_USER:-}" ]; then + BOKFD_USER="$item_user" + export BOKFD_USER + fi ;; *) echo "bokftui-bw: BOKF_BW_KIND must be password or token" >&2 |
