From 7841c77c9ac1ac9a004cce00170d7f8b8e868f94 Mon Sep 17 00:00:00 2001 From: "Olivier@Portable" Date: Thu, 2 Aug 2018 03:51:43 +0200 Subject: allow to use the password filename as user --- rofi-pass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rofi-pass b/rofi-pass index eb29c9a..ca9cb2a 100755 --- a/rofi-pass +++ b/rofi-pass @@ -417,7 +417,11 @@ mainMenu () { fi if [[ -z "${stuff["${USERNAME_field}"]}" ]]; then if [[ -n $default_user ]]; then - stuff["${USERNAME_field}"]="${default_user}" + if [[ "$default_user" == "%filename" ]]; then + stuff["${USERNAME_field}"]="$(basename $selected_password)" + else + stuff["${USERNAME_field}"]="${default_user}" + fi fi fi pass_content="$(for key in "${!stuff[@]}"; do printf '%s\n' "${key}: ${stuff[$key]}"; done)" -- cgit From ac37bca5a45c4a50ea9f75aaf901f12c27d8e1ac Mon Sep 17 00:00:00 2001 From: "Olivier@Portable" Date: Thu, 2 Aug 2018 20:53:27 +0200 Subject: change %filename in :filename for user from filename functionnality --- rofi-pass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rofi-pass b/rofi-pass index ca9cb2a..beabb69 100755 --- a/rofi-pass +++ b/rofi-pass @@ -417,7 +417,7 @@ mainMenu () { fi if [[ -z "${stuff["${USERNAME_field}"]}" ]]; then if [[ -n $default_user ]]; then - if [[ "$default_user" == "%filename" ]]; then + if [[ "$default_user" == ":filename" ]]; then stuff["${USERNAME_field}"]="$(basename $selected_password)" else stuff["${USERNAME_field}"]="${default_user}" -- cgit From db4383a186663e5091a373d46c8096c8fdc8c5af Mon Sep 17 00:00:00 2001 From: "Olivier@Portable" Date: Thu, 2 Aug 2018 20:58:08 +0200 Subject: add documentation about user from filename functionnality --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index e28a9ba..6153601 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,12 @@ Rofi-pass allows you to easily share common used passwords across multiple entri For example, if you have an academic account which includes several services (such as a library, Salary, Student portal etc), all with different URL's, login forms etc. you can share one password across all of them. This is very handy when the passwords change annually. To use this function you need to add the following line instead of the password, referencing a pass file which holds the password. +## User filename as user + +If your password file has no user field you can ask rofi-pass to use the filename instead. +For example with this password file path : `web/fsf.org/rms` rofi-pass will user `rms` as your username. +To get this, you need to set `default_user` to `:filename` in your configuration. + ``` #FILE=PATH/to/filename ``` -- cgit