Merge remote-tracking branch 'ui/master'

This commit is contained in:
Zaid Abdulla committed 2018-12-27 22:22:44 -08:00
commit 4530967b6b
70 files changed
+10951 -8

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
"use strict";
import m from "mithril";
import * as store from "./store";
import * as notifications from "./notifications";
function init(args) {
return Promise.resolve(args);
}
const component = {
view: vnode => {
if (window.username) m.route.set(vnode.attrs.continue || "/");
document.title = "Login - GenieACS";
return [
m("h1", "Log in"),
m(
"form",
m(
"p",
m("label", { for: "username" }, "Username"),
m("input", {
name: "username",
type: "text",
value: vnode.state.username,
oncreate: vnode2 => {
vnode2.dom.focus();
},
oninput: m.withAttr("value", v => (vnode.state.username = v))
})
),
m(
"p",
m("label", { for: "password" }, "Password"),
m("input", {
name: "password",
type: "password",
value: vnode.state.password,
oninput: m.withAttr("value", v => (vnode.state.password = v))
})
),
m(
"p",
m(
"button.primary",
{
type: "submit",
onclick: e => {
e.target.disabled = true;
store
.logIn(vnode.state.username, vnode.state.password)
.then(() => {
location.reload();
})
.catch(err => {
notifications.push("error", err.message);
e.target.disabled = false;
});
return false;
}
},
"Login"
)
)
)
];
}
};
export { init, component };