1

I was wondering if there is a way to let the user remain logged in without having to sign in again if a user decides to close current tab and reopen it again. I am using Django and Python and here is the code I am using for signing in:

def postsign(request):

    email = request.POST.get('email')
    passw = request.POST.get("password")
    try:
        user = auth.sign_in_with_email_and_password(email,passw)
        success = 1
    except:
        success = 0
        message = "invalid cerediantials"

        return render(request,"dashboard.html")

    session_id = user['idToken']
    request.session['uid'] = str(session_id)

    context = {
        "success": success,
        "email": email,
    }
    return render(request, "dashboard.html", context)
Wang Liang
  • 4,244
  • 6
  • 22
  • 45
Ella
  • 43
  • 6
  • check out this answer: https://stackoverflow.com/questions/3024153/how-to-expire-session-due-to-inactivity-in-django – bmons Nov 17 '19 at 07:51
  • thank you for the response, i tried adding the SESSION_EXPIRE_AT_BROWSER_CLOSE to true but no such luck. – Ella Nov 17 '19 at 09:36

0 Answers0