PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, September 2, 2022

[FIXED] How to prevent django admin login and logout sessions from reflecting in actual website?

 September 02, 2022     authentication, django, django-admin, session     No comments   

Issue

I'm quite new to django.

I've made a website that makes use of user auth for login, logout and registration.

Whenever I log into the admin panel, it also gets reflected in the actual website. The admin account gets logged into the website on its own.

I know this is the default behaviour of the django auth system, but I want to separate the auth session of admin panel and the actual website.

How can I do so?

The screenshots below show the thing which I'm talking about.

👇 Here I've logged into the Admin panel.

admin panel

👇 The Admin account got logged into the website on its own by using the admin session..

website home page

I just want that both admin panel and website should have separate auth sessions and shouldn't be linked to each other.

The website is hosted online here

Thanks in advance!


Solution

You could write middleware for this, to explicitly logout authenticated users in non-admin pages as suggested in this answer:

https://stackoverflow.com/a/57357586/2135738



Answered By - user2135738
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing