diff --git a/app/assets/javascripts/app/controllers/login.js.coffee b/app/assets/javascripts/app/controllers/login.js.coffee index ec5f18584..2e5417427 100644 --- a/app/assets/javascripts/app/controllers/login.js.coffee +++ b/app/assets/javascripts/app/controllers/login.js.coffee @@ -41,15 +41,25 @@ class Index extends App.Controller @html App.view('login')( item: data, - auth_providers: auth_providers + auth_providers: auth_providers, ) - if $(@el).find('[name="username"]').val() + + # set focus + if !$(@el).find('[name="username"]').val() $(@el).find('[name="username"]').focus() - + else + $(@el).find('[name="password"]').focus() + + # scroll to top + @scrollTo() + login: (e) -> e.preventDefault() params = @formParam(e.target) + # remember username + @username = params['username'] + # session create with login/password auth = new App.Auth auth.login(