mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Merge pull request #182 from Newbytee/submit-for-login
Use submit event for login instead of click
This commit is contained in:
commit
1c978f060e
@ -94,7 +94,7 @@ export const TAG_NAMES = {
|
|||||||
[HTML_NS]: [
|
[HTML_NS]: [
|
||||||
"br", "a", "ol", "ul", "li", "div", "h1", "h2", "h3", "h4", "h5", "h6",
|
"br", "a", "ol", "ul", "li", "div", "h1", "h2", "h3", "h4", "h5", "h6",
|
||||||
"p", "strong", "em", "span", "img", "section", "main", "article", "aside",
|
"p", "strong", "em", "span", "img", "section", "main", "article", "aside",
|
||||||
"pre", "button", "time", "input", "textarea", "label"],
|
"pre", "button", "time", "input", "textarea", "label", "form"],
|
||||||
[SVG_NS]: ["svg", "circle"]
|
[SVG_NS]: ["svg", "circle"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,20 +46,26 @@ export class LoginView extends TemplateView {
|
|||||||
t.div({className: "LoginView form"}, [
|
t.div({className: "LoginView form"}, [
|
||||||
t.h1([vm.i18n`Sign In`]),
|
t.h1([vm.i18n`Sign In`]),
|
||||||
t.if(vm => vm.error, t.createTemplate(t => t.div({className: "error"}, vm => vm.error))),
|
t.if(vm => vm.error, t.createTemplate(t => t.div({className: "error"}, vm => vm.error))),
|
||||||
t.div({className: "form-row"}, [t.label({for: "username"}, vm.i18n`Username`), username]),
|
t.form({
|
||||||
t.div({className: "form-row"}, [t.label({for: "password"}, vm.i18n`Password`), password]),
|
onSubmit: evnt => {
|
||||||
t.div({className: "form-row"}, [t.label({for: "homeserver"}, vm.i18n`Homeserver`), homeserver]),
|
evnt.preventDefault();
|
||||||
t.mapView(vm => vm.loadViewModel, loadViewModel => loadViewModel ? new SessionLoadStatusView(loadViewModel) : null),
|
vm.login(username.value, password.value, homeserver.value);
|
||||||
t.div({className: "button-row"}, [
|
}
|
||||||
t.a({
|
}, [
|
||||||
className: "button-action secondary",
|
t.div({className: "form-row"}, [t.label({for: "username"}, vm.i18n`Username`), username]),
|
||||||
href: vm.cancelUrl
|
t.div({className: "form-row"}, [t.label({for: "password"}, vm.i18n`Password`), password]),
|
||||||
}, [vm.i18n`Go Back`]),
|
t.div({className: "form-row"}, [t.label({for: "homeserver"}, vm.i18n`Homeserver`), homeserver]),
|
||||||
t.button({
|
t.mapView(vm => vm.loadViewModel, loadViewModel => loadViewModel ? new SessionLoadStatusView(loadViewModel) : null),
|
||||||
className: "button-action primary",
|
t.div({className: "button-row"}, [
|
||||||
onClick: () => vm.login(username.value, password.value, homeserver.value),
|
t.a({
|
||||||
disabled
|
className: "button-action secondary",
|
||||||
}, vm.i18n`Log In`),
|
href: vm.cancelUrl
|
||||||
|
}, [vm.i18n`Go Back`]),
|
||||||
|
t.button({
|
||||||
|
className: "button-action primary",
|
||||||
|
type: "submit"
|
||||||
|
}, vm.i18n`Log In`),
|
||||||
|
]),
|
||||||
]),
|
]),
|
||||||
// use t.mapView rather than t.if to create a new view when the view model changes too
|
// use t.mapView rather than t.if to create a new view when the view model changes too
|
||||||
t.p(hydrogenGithubLink(t))
|
t.p(hydrogenGithubLink(t))
|
||||||
|
Loading…
Reference in New Issue
Block a user