aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoviuro <moviuro+git@gmail.com>2017-11-12 15:28:36 +0100
committerMoviuro <moviuro+git@gmail.com>2017-11-12 15:46:10 +0100
commit0ab35cdcdcb003a29d2488f4fda22d06e6e8a187 (patch)
treebb6751f41e09f5456a1146da80c5c7bb880b3783
parent5e71e31bde7eba44b411c2122a3e420f15398f24 (diff)
downloadrofi-pass-0ab35cdcdcb003a29d2488f4fda22d06e6e8a187.tar.gz
rofi-pass: first integration of pass-otp(1)
-rwxr-xr-xrofi-pass14
1 files changed, 11 insertions, 3 deletions
diff --git a/rofi-pass b/rofi-pass
index 0f3edc2..a2d173c 100755
--- a/rofi-pass
+++ b/rofi-pass
@@ -318,14 +318,22 @@ mainMenu () {
mapfile -t password_temp < <(PASSWORD_STORE_DIR="${root}" pass "${pass_file}")
password=${password_temp[0]}
fi
- fields=$(printf '%s\n' "${password_temp[@]:1}" | awk '$1 ~ /:$/{$1=$1;print}')
+ fields=$(printf '%s\n' "${password_temp[@]:1}" | awk '$1 ~ /:$/ || /otpauth:\/\// {$1=$1;print}')
declare -A stuff
stuff["pass"]=${password}
if [[ -n $fields ]]; then
while read -r LINE; do
- _id="${LINE%%: *}"
- _val="${LINE#* }"
+ case "$LINE" in
+ "otpauth://"*)
+ _id="OTP"
+ _val="$(PASSWORD_STORE_DIR="${root}" pass otp "$selected_password")"
+ ;;
+ *)
+ _id="${LINE%%: *}"
+ _val="${LINE#* }"
+ ;;
+ esac
stuff["${_id}"]=${_val}
done < <(printf '%s\n' "${fields}")
if test "${stuff['autotype']+autotype}"