-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
safe get key for request.META #40
Conversation
@anx-ckreuzberger can you please check and merge |
PR looks fine, but I'm not sure if this is a behaviour that I would want to support without notifying the dev/admin about it. I think I'll make those "default values" configureable in Django Settings. |
sounds good added those values.. |
Thanks! |
It might better to allow users to set the name of the header rather than providing default values if the E.g. so essentially allowing to user to say "hey use HTTP_X_REAL_IP not REMOTE_ADDR please" Perhaps something like this: user_agent_header = getattr(settings, 'DJANGO_REST_PASSWORDRESET_HTTP_USER_AGENT_HEADER', 'HTTP_USER_AGENT')
ip_address_header = getattr(settings, 'DJANGO_REST_PASSWORDRESET_IP_ADDRESS_HEADER', 'REMOTE_ADDR')
token = ResetPasswordToken.objects.create(
user=user,
user_agent=request.META.get(user_agent_header),
ip_address=request.META.get(ip_address_header)
) |
I believe the implementation suggested by @vonorm is correct, the original implementation coming from the Merge Request is faulty. |
No description provided.