2020-11-05 05:09:20 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-11-10 09:13:41 +00:00
|
|
|
// index.js
|
2020-11-05 05:09:20 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
2020-11-25 06:10:02 +00:00
|
|
|
|
2021-09-21 11:59:57 +00:00
|
|
|
var FILE = require("lib/file");
|
|
|
|
var OldBrowser = require("lib/oldbrowser");
|
|
|
|
|
2021-09-21 03:28:25 +00:00
|
|
|
var token;
|
2020-11-05 05:09:20 +00:00
|
|
|
if (FILE.fileExists("token.txt")) {
|
2023-10-30 04:56:43 +00:00
|
|
|
token = FILE.readFile("token.txt", FILE.CdoCharset.CdoUTF_8);
|
2020-11-05 05:09:20 +00:00
|
|
|
}
|
|
|
|
|
2023-10-30 04:56:43 +00:00
|
|
|
OldBrowser.setContent(FILE.readFile("app\\signin.html", FILE.CdoCharset.CdoUTF_8));
|
2020-11-25 08:08:17 +00:00
|
|
|
|
2021-09-21 03:28:25 +00:00
|
|
|
document.getElementById("loginform").onsubmit = function(ev) {
|
|
|
|
ev.preventDefault();
|
|
|
|
};
|
2020-11-05 05:09:20 +00:00
|
|
|
|
2021-09-21 03:28:25 +00:00
|
|
|
if (FILE.fileExists("credential.json")) {
|
2023-10-30 04:56:43 +00:00
|
|
|
var credential = JSON.parse(FILE.readFile("credential.json", FILE.CdoCharset.CdoUTF_8));
|
2021-09-21 03:28:25 +00:00
|
|
|
document.getElementById("txt_email").value = credential.email;
|
|
|
|
document.getElementById("txt_password").value = credential.password;
|
2020-11-05 05:09:20 +00:00
|
|
|
}
|
2021-09-21 03:28:25 +00:00
|
|
|
|
|
|
|
document.getElementById("btn_submit").onclick = function() {
|
|
|
|
var credential = {
|
|
|
|
"email": document.getElementById("txt_email").value,
|
|
|
|
"password": document.getElementById("txt_password").value
|
|
|
|
};
|
|
|
|
|
2023-10-30 04:56:43 +00:00
|
|
|
FILE.writeFile("credential.json", JSON.stringify(credential), FILE.CdoCharset.CdoUTF_8);
|
2021-09-21 03:28:25 +00:00
|
|
|
};
|