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:
parent
75e5f52871
commit
59e5ab2390
|
@ -82,8 +82,8 @@ def login(account_id):
|
||||||
@app.route('/login/twitter/callback')
|
@app.route('/login/twitter/callback')
|
||||||
def twitter_login_step2():
|
def twitter_login_step2():
|
||||||
try:
|
try:
|
||||||
oauth_token = request.args['oauth_token']
|
oauth_token = request.args.get('oauth_token', '')
|
||||||
oauth_verifier = request.args['oauth_verifier']
|
oauth_verifier = request.args.get('oauth_verifier', '')
|
||||||
token = libforget.twitter.receive_verifier(
|
token = libforget.twitter.receive_verifier(
|
||||||
oauth_token, oauth_verifier,
|
oauth_token, oauth_verifier,
|
||||||
**app.config.get_namespace("TWITTER_"))
|
**app.config.get_namespace("TWITTER_"))
|
||||||
|
@ -92,7 +92,7 @@ def twitter_login_step2():
|
||||||
|
|
||||||
g.viewer = session
|
g.viewer = session
|
||||||
return redirect(url_for('index'))
|
return redirect(url_for('index'))
|
||||||
except (TwitterError, URLError):
|
except Exception:
|
||||||
if sentry:
|
if sentry:
|
||||||
sentry.captureException()
|
sentry.captureException()
|
||||||
return redirect(
|
return redirect(
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<h2 id="sign_in">Sign in</h2>
|
<h2 id="sign_in">Sign in</h2>
|
||||||
{% if twitter_login_error %}
|
{% if twitter_login_error %}
|
||||||
<div class="banner 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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue