1๐
โ
I dont understand whats wrong with your code. why do you say its wrong ?
Other then that,why dont you prefer to use the Auth login form ? Look at AuthenticationForm in the Auth module, Its done exactly what you are trying to do.
Also , you should consider to pass a Request Context in your view , this way you will not have to pass the csrf manually.
๐คNuno_147
Source:stackexchange.com