Fixed form login and added CSRF support