Skip to content

Commit

Permalink
Merge 66644fe into 7e8cd48
Browse files Browse the repository at this point in the history
  • Loading branch information
pamfilos committed Mar 31, 2017
2 parents 7e8cd48 + 66644fe commit bd45f12
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions invenio_oauthclient/views/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

from __future__ import absolute_import

from flask import Blueprint, abort, current_app, request, url_for
from flask import Blueprint, abort, current_app, redirect, request, url_for
from flask_oauthlib.client import OAuthException
from invenio_db import db
from itsdangerous import BadData, TimedJSONWebSignatureSerializer
from werkzeug.local import LocalProxy
Expand All @@ -31,6 +32,7 @@
from ..proxies import current_oauthclient
from ..utils import get_safe_redirect_target


blueprint = Blueprint(
'invenio_oauthclient',
__name__,
Expand Down Expand Up @@ -126,7 +128,12 @@ def authorized(remote_app=None):
not(current_app.debug or current_app.testing)):
abort(403)

return current_oauthclient.handlers[remote_app]()
try:
handler = current_oauthclient.handlers[remote_app]()
except OAuthException:
return redirect('/')

return handler


@blueprint.route('/signup/<remote_app>/', methods=['GET', 'POST'])
Expand Down

0 comments on commit bd45f12

Please sign in to comment.