Thursday, July 30, 2020

Re: Django automatic Logout and and after login it stays on same page

Please help me if someone facing the same issue.

Regards
Isha

From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf of Isha Thakur <Isha.Thakur@enablence.com>
Sent: July 29, 2020 1:28 PM
To: django-users@googlegroups.com <django-users@googlegroups.com>
Subject: Re: Django automatic Logout and and after login it stays on same page
 
I mean, suppose I logged in, accessed my website, and closed the browser. Sometimes when I try to access my website next time the session is closed(logout). This does not happen all the time it happens once in a month.

When I do log out manually(I mean when I click on the logout button on my website) and login back then I ma not facing any issue.

Regards
Isha

From: django-users@googlegroups.com <django-users@googlegroups.com> on behalf of jhabar singh <jhabarsingh.wfhsolve@gmail.com>
Sent: July 29, 2020 12:20 AM
To: django-users@googlegroups.com <django-users@googlegroups.com>
Subject: Re: Django automatic Logout and and after login it stays on same page
 
by the way how can django logout automatically. I mean user should only be given the access to do so. 

On Wed, Jul 29, 2020 at 3:37 AM isha thakur <thakurisha1323@gmail.com> wrote:
I am new to Django and using Django 3.0.2. Sometimes Django automatically logout and when I try to log in on my website then it stays on the login page but creates a session(I mean, I can see all the buttons which a user will see after login in header and footer). I am not experiencing this issue when I am manually logging out and logging in.Please help if someone else is also experiencing the same issue. Thanks in advance. Please check my code below:

setting.py: 

LOGIN_REDIRECT_URL = 'index_login'

LOGIN_URL = 'login' 


urls.py: 


url(r'^login$',auth_views.LoginView.as_view(redirect_authenticated_user=True),name='login'), url(r'^index_login', views.index_login, name='index_login')

view.py:


@login_required
def index_login(request):
# this view is created solely for the purpose of being able to log the login information through logToDb
ut.logToDb(database, messages=['Successful login.'], user=request.user)
ut.log_info('Successful login by ' + str(request.user) + '.')
context = {'user': request.user}
return render(request, 'mainapp/index.html', context)

index.html:
 {% extends 'mainapp/base.html' %} 
{% load static %} {% block content %}
 <h3>Databases</h3> <br/><br/> 
<div class="fluid-container">
 <div class="col-md-4"> <a class="btn btn-primary btn-block btn-vspace" type="button" href="plc/index">Inventory</a> </div>
 </div>
 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
 {% endblock %}

I am facing this problem only if Django logout automatically. But if I logout and login then I am not having issue so It is really tricky for me to generate the exact scenario

Regards
Isha

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2392d64f-0110-4fe2-a5ec-5af27c561a6ao%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJ1QTgmP2Lq4q%2B9i5tGdb7%2B2F9n6uF_Pn7cvkF4wqeByhLZABA%40mail.gmail.com.
NOTICE:This email and any files transmitted with it are Enablence confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. This message contains Enablence confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/DM6PR12MB45798AE9DA4379E2B893C6CBF0700%40DM6PR12MB4579.namprd12.prod.outlook.com.
NOTICE:This email and any files transmitted with it are Enablence confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. This message contains Enablence confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

No comments:

Post a Comment