From ad8559beb88fd7a7d8df9e7ec6a00b3963cd9a2f Mon Sep 17 00:00:00 2001 From: Ayush Agarwal Date: Wed, 16 Feb 2022 22:19:12 +0530 Subject: refactor: offload otp handling to key_otp --- tessen | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tessen b/tessen index b116dc0..1f7a1bf 100755 --- a/tessen +++ b/tessen @@ -416,8 +416,6 @@ key_open_url() { # SECOND MENU: the default autotype function, either autotype the username and # password or the custom autotype defined by the user -# POTENTIAL IMPROVEMENT: Anything better than this ugly hack of -# else..for..case..if..else..if? auto_type_def() { local word tmp_otp @@ -432,18 +430,7 @@ auto_type_def() { ":tab") wtype -s "$tsn_delay" -k Tab -- ;; ":space") wtype -s "$tsn_delay" -k space -- ;; ":enter") wtype -s "$tsn_delay" -k Return -- ;; - ":otp") - if ! pass otp -h > /dev/null 2>&1; then - _die "pass-otp is not installed" - else - tmp_otp="$(pass otp "$tsn_passfile")" - if [[ "$tmp_otp" =~ ^[[:digit:]]+$ ]]; then - printf "%s" "$tmp_otp" | wtype -s "$tsn_delay" - - else - _die "invalid OTP detected" - fi - fi - ;; + ":otp") key_otp ;; path | basename | filename) printf "%s" "${tsn_passfile##*/}" | wtype -s "$tsn_delay" - ;; "$tsn_userkey") printf "%s" "$tsn_username" | wtype -s "$tsn_delay" - ;; pass | password) printf "%s" "$tsn_password" | wtype -s "$tsn_delay" - ;; -- cgit v1.2.3