Fixed LoginController and error handling in js.