Skip to content

Commit

Permalink
Merge pull request #40 from talbenbasat/master
Browse files Browse the repository at this point in the history
safe get key for request.META
  • Loading branch information
anx-ckreuzberger authored May 10, 2019
2 parents 7118d43 + 314577b commit f731c88
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions django_rest_passwordreset/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ def post(self, request, *args, **kwargs):
# no token exists, generate a new token
token = ResetPasswordToken.objects.create(
user=user,
user_agent=request.META['HTTP_USER_AGENT'],
ip_address=request.META['REMOTE_ADDR']
user_agent=request.META.get('HTTP_USER_AGENT',
getattr(settings, 'DJANGO_REST_PASSWORDRESET_HTTP_USER_AGENT', '')),
ip_address=request.META.get('REMOTE_ADDR',
getattr(settings, 'DJANGO_REST_PASSWORDRESET_REMOTE_ADDR', ''))
)
# send a signal that the password token was created
# let whoever receives this signal handle sending the email for the password reset
Expand Down

0 comments on commit f731c88

Please sign in to comment.