Fix oauth2 authorisation form not working
This commit is contained in:
parent
9967319294
commit
76a43a7818
|
@ -56,6 +56,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.staticfiles',
|
||||
'reversion',
|
||||
'rest_framework',
|
||||
'crispy_forms',
|
||||
'passbook.core',
|
||||
'passbook.admin',
|
||||
'passbook.api',
|
||||
|
@ -66,9 +67,6 @@ INSTALLED_APPS = [
|
|||
'passbook.oauth_provider',
|
||||
'passbook.saml_idp',
|
||||
'passbook.tfa',
|
||||
'crispy_forms',
|
||||
'oauth2_provider',
|
||||
'corsheaders',
|
||||
]
|
||||
|
||||
# Message Tag fix for bootstrap CSS Classes
|
||||
|
@ -246,16 +244,11 @@ with CONFIG.cd('log'):
|
|||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
},
|
||||
'flower': {
|
||||
'oauth2_provider': {
|
||||
'handlers': LOG_HANDLERS,
|
||||
'level': 'DEBUG',
|
||||
'propagate': True,
|
||||
},
|
||||
'celery': {
|
||||
'handlers': LOG_HANDLERS,
|
||||
'level': 'WARNING',
|
||||
'propagate': True,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="{% static 'css/patternfly.min.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'css/patternfly-additions.min.css' %}">
|
||||
</head>
|
||||
<body {% if is_login or client_id %} class="login-pf" {% endif %}>
|
||||
<body {% if is_login %} class="login-pf" {% endif %}>
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
<script src="{% static 'js/jquery.min.js' %}"></script>
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
CORS_ORIGIN_ALLOW_ALL = True
|
||||
REQUEST_APPROVAL_PROMPT = 'auto'
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'oauth2_provider',
|
||||
'corsheaders',
|
||||
]
|
||||
MIDDLEWARE = [
|
||||
'oauth2_provider.middleware.OAuth2TokenMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
{% if not error %}
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% endif %}
|
||||
{% if field.is_hidden %}
|
||||
{{ field }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="form-group">
|
||||
<p class="subtitle">
|
||||
|
@ -42,7 +42,7 @@
|
|||
<a href="{% url 'passbook_core:auth-logout' %}">{% trans 'Logout' %}</a>
|
||||
</p>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success btn-lg">{% trans 'Continue' %}</button>
|
||||
<input type="submit" class="btn btn-success btn-lg" name="allow" value="{% trans 'Continue' %}">
|
||||
<a href="{% back %}" class="btn btn-default btn-lg">{% trans "Cancel" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
from django.urls import include, path
|
||||
|
||||
# from passbook.oauth_provider.views import oauth2
|
||||
from passbook.oauth_provider.views import oauth2
|
||||
|
||||
urlpatterns = [
|
||||
# Custom OAuth 2 Authorize View
|
||||
# path('authorize/', oauth2.PassbookAuthorizationView.as_view(), name="oauth2-authorize"),
|
||||
path('authorize/', oauth2.PassbookAuthorizationView.as_view(), name="oauth2-authorize"),
|
||||
# OAuth API
|
||||
path('', include('oauth2_provider.urls', namespace='oauth2_provider')),
|
||||
]
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
"""passbook OAuth2 Views"""
|
||||
|
||||
# from logging import getLogger
|
||||
from logging import getLogger
|
||||
|
||||
# from django.contrib import messages
|
||||
# from django.http import Http404, HttpResponseRedirect
|
||||
# from django.utils.translation import ugettext as _
|
||||
# from oauth2_provider.models import get_application_model
|
||||
# from oauth2_provider.views.base import AuthorizationView
|
||||
from oauth2_provider.views.base import AuthorizationView
|
||||
|
||||
# # from passbook.core.models import Event, UserAcquirableRelationship
|
||||
# from passbook.core.models import Event, UserAcquirableRelationship
|
||||
|
||||
# LOGGER = getLogger(__name__)
|
||||
LOGGER = getLogger(__name__)
|
||||
|
||||
|
||||
class PassbookAuthorizationView(AuthorizationView):
|
||||
"""Custom OAuth2 Authorization View which checks rules, etc"""
|
||||
|
||||
def render_to_response(self, context, **kwargs):
|
||||
# Always set is_login to true for correct css class
|
||||
context['is_login'] = True
|
||||
return super().render_to_response(context, **kwargs)
|
||||
|
||||
# class PassbookAuthorizationView(AuthorizationView):
|
||||
# """Custom OAuth2 Authorization View which checks for invite_only products"""
|
||||
|
||||
|
|
Reference in New Issue