I want to understand the difference b/w both
user = authenticate(
username=form.cleaned_data.get('username'),
password=form.cleaned_data.get('password1')
)
login(request, user)
答案 0 :(得分:1)
The authenticate() method accepts username and password and validates if the the credentials entered are those of valid user. If yes, it returns an user object.
The Login method takes an HttpRequest object and auth_user object . and Logs the user in and binds him not only to the request object but also in Session.