Skip to content Skip to sidebar Skip to footer

Django Logging In As Anonymous User?

I am trying to login a user . after creating his profile . but when he authorises him he logs in as anonymous user. from django.contrib.auth import authenticate as authorise def s

Solution 1:

You need to call login function after authenticate.

from django.contrib.authimport login as auth_login
auth_login(request, user)

Solution 2:

You need to send password entered by user to authorise as it is, don't need to shs224 it. authorise will take care of hashing it.

from django.contrib.auth import login

#remove md5 step
authuser = authorise(username=username, password=password)
login(authuser, request)

You need to call login after authenticate.

Post a Comment for "Django Logging In As Anonymous User?"