Add oauth disconnect for testing

This commit is contained in:
Edward Betts 2019-09-27 20:19:29 +01:00
parent d982f975cf
commit 51c245d637

9
app.py
View file

@ -240,9 +240,16 @@ def oauth_callback():
session['owner_key'] = oauth_tokens.get('oauth_token') session['owner_key'] = oauth_tokens.get('oauth_token')
session['owner_secret'] = oauth_tokens.get('oauth_token_secret') session['owner_secret'] = oauth_tokens.get('oauth_token_secret')
next_page = session.get('next_page') next_page = session.get('after_login')
return redirect(next_page) if next_page else random_painting() return redirect(next_page) if next_page else random_painting()
@app.route('/oauth/disconnect')
def oauth_disconnect():
for key in 'owner_key', 'owner_secret', 'username', 'after_login':
if key in session:
del session[key]
return random_painting()
def get_username(): def get_username():
if 'owner_key' not in session: if 'owner_key' not in session:
return # not authorized return # not authorized