fix #14 Error returning to forget after cancelling authorization

turns out request.args has some special behaviour that forces a 400
instead of throwing a KeyError when trying to read an arg that wasn't
supplied :/ havent seen anything about it in flask's docs
This commit is contained in:
codl 2017-11-02 15:44:31 +01:00
parent 75e5f52871
commit 59e5ab2390
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
2 changed files with 4 additions and 4 deletions

View File

@ -82,8 +82,8 @@ def login(account_id):
@app.route('/login/twitter/callback')
def twitter_login_step2():
try:
oauth_token = request.args['oauth_token']
oauth_verifier = request.args['oauth_verifier']
oauth_token = request.args.get('oauth_token', '')
oauth_verifier = request.args.get('oauth_verifier', '')
token = libforget.twitter.receive_verifier(
oauth_token, oauth_verifier,
**app.config.get_namespace("TWITTER_"))
@ -92,7 +92,7 @@ def twitter_login_step2():
g.viewer = session
return redirect(url_for('index'))
except (TwitterError, URLError):
except Exception:
if sentry:
sentry.captureException()
return redirect(

View File

@ -23,7 +23,7 @@
<h2 id="sign_in">Sign in</h2>
{% if twitter_login_error %}
<div class="banner error">
Sorry, something went wrong when communicating with Twitter. Give it another shot, maybe?
Sorry, something went wrong when logging you in with Twitter. Give it another shot, maybe?
</div>
{% endif %}