Skip to content

Commit f3f25cb

Browse files
author
Philip Douglas
committed
Prevent user passwords showing in error emails
Use the sensitive_post_parameters decorator to redact user passwords when an error occurs in the token view.
1 parent b3d6312 commit f3f25cb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

oauth2_provider/views/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import logging
22

33
from django.http import HttpResponse, HttpResponseRedirect
4+
from django.views.decorators.debug import sensitive_post_parameters
45
from django.views.generic import View, FormView
56
from django.utils import timezone
7+
from django.utils.decorators import method_decorator
68

79
from oauthlib.oauth2 import Server
810

@@ -150,6 +152,7 @@ class TokenView(CsrfExemptMixin, OAuthLibMixin, View):
150152
server_class = Server
151153
validator_class = oauth2_settings.OAUTH2_VALIDATOR_CLASS
152154

155+
@method_decorator(sensitive_post_parameters('password'))
153156
def post(self, request, *args, **kwargs):
154157
url, headers, body, status = self.create_token_response(request)
155158
response = HttpResponse(content=body, status=status)

0 commit comments

Comments
 (0)