Improved auto focus of login fields.
This commit is contained in:
parent
10c2ab62f7
commit
b841834c3e
1 changed files with 13 additions and 3 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue