From 07b5e5890fedbf71a1503f984dfbc2baa872223c Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Fri, 18 Sep 2026 13:58:11 +0200 Subject: 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. --- scripts/bokftui-bw | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/bokftui-bw') 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 -- cgit v1.3