mirror of
https://github.com/yawaflua/Flask-Discord.git
synced 2025-12-10 12:29:30 +02:00
Add authorized property
This commit is contained in:
@@ -61,13 +61,18 @@ class DiscordOAuth2Session(_http.DiscordOAuth2HttpClient):
|
|||||||
|
|
||||||
def revoke(self):
|
def revoke(self):
|
||||||
"""This method clears current discord token, state and all session data from flask
|
"""This method clears current discord token, state and all session data from flask
|
||||||
session <http://flask.pocoo.org/docs/1.0/api/#flask.session>. Which means user will have
|
`session <http://flask.pocoo.org/docs/1.0/api/#flask.session>`_. Which means user will have
|
||||||
to go through discord authorization token grant flow again.
|
to go through discord authorization token grant flow again.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for session_key in self.SESSION_KEYS:
|
for session_key in self.SESSION_KEYS:
|
||||||
session.pop(session_key)
|
session.pop(session_key)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def authorized(self):
|
||||||
|
"""A boolean indicating whether current session has authorization token or not."""
|
||||||
|
return self._make_session().authorized
|
||||||
|
|
||||||
def fetch_user(self):
|
def fetch_user(self):
|
||||||
return models.User(self.get("/users/@me"))
|
return models.User(self.get("/users/@me"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user