2👍
✅
authenticate
only verifies that username and password are correct and returns User instance found for that pair. To actually log user in and have it available in templates, sessions etc you need to call login
login(request, user)
0👍
short answer: use the built-in authentication. Don’t try to write youu own. https://docs.djangoproject.com/en/dev/topics/auth/
- your code is totally broken – in the
login
view the variablesuname
andpwd
are undefined. please post working code. - you seem to be doing authentication yourself – why don’t you just use the built in authentication methods?
- it looks like part of your problem is that you defining a logged-in user with the variable
user
but that only exists in the scope of the functionlogon
– the rest of your code is checkingrequest.user
. This is why you need to use the built in authentication methods.
- [Answered ]-Django allauth – How to know if user is logged in with socialaccount or account?
- [Answered ]-Django Apache SSL [code 400, message bad request]
- [Answered ]-Django get base model from parent model
- [Answered ]-Redirect certain user to certain view in django
- [Answered ]-Apache config with static site and django wsgi app
Source:stackexchange.com