diff options
author | Abhiseck Paira <abhiseckpaira@disroot.org> | 2022-02-25 19:43:08 +0530 |
---|---|---|
committer | Abhiseck Paira <abhiseckpaira@disroot.org> | 2022-02-25 19:43:08 +0530 |
commit | 6ac09ec8bc5f3011e59602b030d45ce3f3860e25 (patch) | |
tree | b92b95e7d25ceb9476d8251e410546ba8721d560 /lisp/mastodon-auth.el | |
parent | 1e4ab751683d497243f719c70cccb0450c9cb451 (diff) |
auth: make old mastodon.el users aware
Most old users of the mastodon.el wouldn't know about the introduction
of new variable `mastodon-active-user'[1]. Our goal is to make them
aware.
Set the default value of [1] to nil. This way we can know that the user
hasn't set [1] properly because user is unaware of it.
In the definition of `mastodon-auth--access-token', check [1]'s value
and if it's null, explain to the user about the new situation. Finally
signal the error "Variables not set properly".
We have considered the possibility of automating the process but since
the new login mechanism depends on setting [1] *in the init file*, the
only way to automate it would be to write to user's init file which we
consider to be very rude and shouldn't be done by this package.
Diffstat (limited to 'lisp/mastodon-auth.el')
-rw-r--r-- | lisp/mastodon-auth.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/mastodon-auth.el b/lisp/mastodon-auth.el index 491d6ae..bad9e08 100644 --- a/lisp/mastodon-auth.el +++ b/lisp/mastodon-auth.el @@ -48,6 +48,7 @@ (defvar mastodon-instance-url) (defvar mastodon-client-scopes) (defvar mastodon-client-redirect-uri) +(defvar mastodon-active-user) (defgroup mastodon-auth nil "Authenticate with Mastodon." @@ -172,6 +173,13 @@ Generate/save token if none known yet." mastodon-auth--token-alist) (alist-get mastodon-instance-url mastodon-auth--token-alist nil nil 'equal)) + ((null mastodon-active-user) + ;; user not aware of 2FA related changes and has not set the + ;; `mastodon-active-user' properly. Make user aware and error + ;; out. + (mastodon-auth--show-notice mastodon-auth--user-unaware + "*mastodon-notice*") + (error "Variables not set properly")) (t ;; user access-token needs to fetched from the server and ;; stored and variables initialised. |