diff --git a/passbook/core/templates/login/denied.html b/passbook/core/templates/login/denied.html index 5ffaa0394..de8fb1a60 100644 --- a/passbook/core/templates/login/denied.html +++ b/passbook/core/templates/login/denied.html @@ -18,7 +18,6 @@

{% trans title %}

-{% include 'partials/messages.html' %}
{% csrf_token %} {% include 'partials/form_login.html' %} diff --git a/passbook/oauth_provider/templates/oauth2_provider/authorize.html b/passbook/oauth_provider/templates/oauth2_provider/authorize.html index 134acc939..4060f0090 100644 --- a/passbook/oauth_provider/templates/oauth2_provider/authorize.html +++ b/passbook/oauth_provider/templates/oauth2_provider/authorize.html @@ -11,7 +11,6 @@

{% trans 'Authorize Application' %}

-{% include 'partials/messages.html' %} {% csrf_token %} {% if not error %} diff --git a/passbook/oauth_provider/views/oauth2.py b/passbook/oauth_provider/views/oauth2.py index f30d14e12..840991cc9 100644 --- a/passbook/oauth_provider/views/oauth2.py +++ b/passbook/oauth_provider/views/oauth2.py @@ -7,6 +7,7 @@ from django.utils.translation import ugettext as _ from oauth2_provider.views.base import AuthorizationView from passbook.audit.models import AuditEntry +from passbook.core.models import Application from passbook.core.views.access import AccessMixin from passbook.core.views.utils import LoadingView, PermissionDeniedView from passbook.oauth_provider.models import OAuth2Provider @@ -38,14 +39,17 @@ class PassbookAuthorizationView(AccessMixin, AuthorizationView): # Get client_id to get provider, so we can update skip_authorization field client_id = request.GET.get('client_id') provider = get_object_or_404(OAuth2Provider, client_id=client_id) - application = self.provider_to_application(provider) + try: + application = self.provider_to_application(provider) + except Application.DoesNotExist: + return redirect('passbook_oauth_provider:oauth2-permission-denied') # Update field here so oauth-toolkit does work for us provider.skip_authorization = application.skip_authorization provider.save() self._application = application # Check permissions if not self.user_has_access(self._application, request.user): - return redirect(reverse('passbook_oauth_provider:oauth2-permission-denied')) + return redirect('passbook_oauth_provider:oauth2-permission-denied') actual_response = super().dispatch(request, *args, **kwargs) if actual_response.status_code == 400: LOGGER.debug(request.GET.get('redirect_uri')) diff --git a/passbook/saml_idp/templates/saml/idp/login.html b/passbook/saml_idp/templates/saml/idp/login.html index 7c2087045..a357a7b39 100644 --- a/passbook/saml_idp/templates/saml/idp/login.html +++ b/passbook/saml_idp/templates/saml/idp/login.html @@ -11,7 +11,6 @@

{% trans 'Authorize Application' %}

-{% include 'partials/messages.html' %} > {% csrf_token %}