forked from CGM_Public/pretix_original
Add signal for new OAuth applications
This commit is contained in:
@@ -232,3 +232,10 @@ styles. It is advisable to set a prefix for your form to avoid clashes with othe
|
||||
|
||||
As with all plugin signals, the ``sender`` keyword argument will contain the event.
|
||||
"""
|
||||
|
||||
oauth_application_registered = Signal(
|
||||
providing_args=["user", "application"]
|
||||
)
|
||||
"""
|
||||
This signal will be called whenever a user registers a new OAuth application.
|
||||
"""
|
||||
|
||||
@@ -18,6 +18,7 @@ from oauth2_provider.views import (
|
||||
from pretix.api.models import (
|
||||
OAuthAccessToken, OAuthApplication, OAuthRefreshToken,
|
||||
)
|
||||
from pretix.control.signals import oauth_application_registered
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -43,6 +44,9 @@ class OAuthApplicationRegistrationView(ApplicationRegistration):
|
||||
def form_valid(self, form):
|
||||
form.instance.client_type = 'confidential'
|
||||
form.instance.authorization_grant_type = 'authorization-code'
|
||||
oauth_application_registered.send(
|
||||
sender=self.request, user=self.request.user, application=form.instance
|
||||
)
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user