How can I make the user login automatically after email verification?
This function works if the password is not hashed.
from django.contrib import auth
try:
uid = urlsafe_base64_decode(uidb64).decode()
user = Account._default_manager.get(pk=uid)
except(TypeError, ValueError, OverflowError, Account.DoesNotExist):
user = None
userlogin = auth.authenticate(email=user.email, password=user.password)
auth.login(request, userlogin)
I want email confirmation from the user, so I can only use the hashed password but encrypted password does not work with this function.
Error:
AttributeError: ‘AnonymousUser’ object has no attribute ‘_meta’
Do you have any suggestion?
Thank you.