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')(
|
@html App.view('login')(
|
||||||
item: data,
|
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()
|
$(@el).find('[name="username"]').focus()
|
||||||
|
else
|
||||||
|
$(@el).find('[name="password"]').focus()
|
||||||
|
|
||||||
|
# scroll to top
|
||||||
|
@scrollTo()
|
||||||
|
|
||||||
login: (e) ->
|
login: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
params = @formParam(e.target)
|
params = @formParam(e.target)
|
||||||
|
|
||||||
|
# remember username
|
||||||
|
@username = params['username']
|
||||||
|
|
||||||
# session create with login/password
|
# session create with login/password
|
||||||
auth = new App.Auth
|
auth = new App.Auth
|
||||||
auth.login(
|
auth.login(
|
||||||
|
|
Loading…
Reference in a new issue