Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 964343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:48:43+00:00 2026-05-16T01:48:43+00:00

How can auth can be configured or modified to disallow user sessions if the

  • 0

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..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:48:44+00:00Added an answer on May 16, 2026 at 1:48 am

    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:

    if request.META['REMOTE_ADDR'] == ip_from_database: `
    # Do something
    else:
     #redirect to login
    

    you can make the above a function that is always called before anything else in a view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can you use contrib.auth.models.User or any of contrib.auth along with Django MongoDB Engine ?
How can I set the Basic Auth user id and password when using a
I'm trying to follow the Auth example for Webapp2 that can be found here:
How can I extend Auth to allow for multiple users with the same username.
I have a web application that uses Forms Auth against a custom user store.
I successfully configured Glassfish to work with JDBCrealm using Basic Auth. But it's not
I can't seem to find the option Enhanced Auth Dialog like the docs suggest
The Apache module auth_tkt creates authentication cookies that can be verified cryptographically so a
Can somebody explain what ASPXAuth cookie does? My website uses forms auth and I
I'm using the django_openid_auth module and have it configured to automatically create new user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.