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
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
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
RegardsIsha
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.
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.
No comments:
Post a Comment