forked from mystiq/hydrogen-web
Use submit event for login trigger
Signed-off-by: Newbyte <newbie13xd@gmail.com>
This commit is contained in:
parent
3ab70861cc
commit
e112e9c2d2
1 changed files with 20 additions and 14 deletions
|
@ -46,6 +46,12 @@ export class LoginView extends TemplateView {
|
|||
t.div({className: "LoginView form"}, [
|
||||
t.h1([vm.i18n`Sign In`]),
|
||||
t.if(vm => vm.error, t.createTemplate(t => t.div({className: "error"}, vm => vm.error))),
|
||||
t.form({
|
||||
onSubmit: evnt => {
|
||||
evnt.preventDefault();
|
||||
vm.login(username.value, password.value, homeserver.value);
|
||||
}
|
||||
}, [
|
||||
t.div({className: "form-row"}, [t.label({for: "username"}, vm.i18n`Username`), username]),
|
||||
t.div({className: "form-row"}, [t.label({for: "password"}, vm.i18n`Password`), password]),
|
||||
t.div({className: "form-row"}, [t.label({for: "homeserver"}, vm.i18n`Homeserver`), homeserver]),
|
||||
|
@ -57,10 +63,10 @@ export class LoginView extends TemplateView {
|
|||
}, [vm.i18n`Go Back`]),
|
||||
t.button({
|
||||
className: "button-action primary",
|
||||
onClick: () => vm.login(username.value, password.value, homeserver.value),
|
||||
disabled
|
||||
type: "submit"
|
||||
}, vm.i18n`Log In`),
|
||||
]),
|
||||
]),
|
||||
// use t.mapView rather than t.if to create a new view when the view model changes too
|
||||
t.p(hydrogenGithubLink(t))
|
||||
])
|
||||
|
|
Loading…
Reference in a new issue