How can auth can be configured or modified to disallow user sessions if the user’s IP is not the same IP that he logged in with ?
I really try to protect my Django site from XSS as much as I can. But I never can be sure that I covered all the bases. If worst comes to worst and someone is able to put some XSS in my site, at least this could prevent him from hijacking existing user sessions..
How can auth can be configured or modified to disallow user sessions if the
Share
In your User model class create an IP field that stores the IP address of the request.
original_ip_address = request.META['REMOTE_ADDR']then before serving a view simply check the current request with the stored ip:
you can make the above a function that is always called before anything else in a view.