Browse Source

bitwarden: filter non-logins from search

Since we're assuming that all auth-source searches are for logins, we
need to filter them out in case username is nil (which just returns all
results without looping).
Sean Farley 7 years ago
parent
commit
6965b0215c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      bitwarden.el

+ 3 - 1
bitwarden.el

@@ -333,7 +333,9 @@ Returns a vector of hashtables of the results."
 ACCOUNTS can be the results of `bitwarden-search' or a string to
 search which will call `bitwarden-search' as a convenience."
   (let* ((accounts (if (vectorp accounts)
-                       accounts (bitwarden-search accounts))))
+                       accounts (bitwarden-search accounts)))
+         ;; filter out matches that are not logins
+         (accounts (seq-filter (lambda (elt) (gethash "login" elt)) accounts)))
     (if (and (stringp username) (not (string= username "")))
         (seq-filter (lambda (elt)
                       (when-let* ((login (gethash "login" elt)))