aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-07-28 22:49:18 +0200
committerGravatar Tom Willemsen2012-07-28 22:49:18 +0200
commitcdccaa9311cbe1c2af146cda0321886c4aad0879 (patch)
tree81f2e9e04610c287fd07d8cbe8a0e1502efea87b
parent3d4e26cbe0cea8bfa949aa7de1a453183ec3ba80 (diff)
downloadavandu-cdccaa9311cbe1c2af146cda0321886c4aad0879.tar.gz
avandu-cdccaa9311cbe1c2af146cda0321886c4aad0879.zip
Clean up data when login fails
Before, when attempting to log in, and failing, the username and password were retained and subsequent attempts would also fail. Now the data is deleted and new login requests will start fresh.
-rw-r--r--avandu.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/avandu.el b/avandu.el
index c1a2afb..1e09e7f 100644
--- a/avandu.el
+++ b/avandu.el
@@ -125,6 +125,12 @@ doesn't sort the list, so you'll have to set that up in tt-rss.
(set (make-local-variable 'revert-buffer-function)
#'(lambda (ignore-auto noconfirm) (avandu-list))))
+(defun avandu--clear-data ()
+ "Clean up login data. This makes for a clean slate next time."
+ (setq avandu-user nil
+ avandu-password nil
+ avandu--session-id nil))
+
(defun avandu--get-status-id (results)
"Get the status id from RESULTS."
(cdr (assq 'status results)))
@@ -139,6 +145,7 @@ otherwise. Signals an error if we're not logged in *and* login
was unsuccesful."
(unless (or (and avandu--session-id (avandu-logged-in-p))
(avandu-login))
+ (avandu--clear-data)
(error "Could not log in to tt-rss")))
(defmacro avandu-getset (var prompt &optional passwdp)
@@ -214,7 +221,7 @@ in. This function returns t if we are, or nil if we're not."
result)))
(defun avandu-login ()
- "Send a request to log in to tt-rss. If `avandu-username' or
+ "Send a request to log in to tt-rss. If `avandu-user' or
`avandu-password' have not been specified they will be asked for
and saved in memory. This function returns t on succes, nil
otherwise."