Add bad coders webring, update kumaos.
This commit is contained in:
parent
770369c84b
commit
dc0b9b14cb
17 changed files with 401 additions and 155 deletions
43
static/kumos/system/login.mjs
Normal file
43
static/kumos/system/login.mjs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { Process, Window, getScreenRoot, promoteWindow } from "../kernel.mjs";
|
||||
import createShell from "./shell.mjs";
|
||||
|
||||
export default function init(p) {
|
||||
function login(password) {
|
||||
if (password == "demo") {
|
||||
p.detach();
|
||||
new Process("shell", createShell);
|
||||
w.destroy();
|
||||
} else {
|
||||
console.log("Invalid password.")
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Please log in with login(password)!");
|
||||
window.login = login;
|
||||
const w = new Window(p);
|
||||
w.setTitle("Login");
|
||||
w.window.style.height = "fit-content";
|
||||
w.window.style.width = "fit-content";
|
||||
w.window.style.resize = "none";
|
||||
|
||||
const loginForm = document.createElement("div");
|
||||
loginForm.style.display = "flex";
|
||||
|
||||
const passwordInput = document.createElement("input");
|
||||
passwordInput.type = "password";
|
||||
passwordInput.placeholder = "Password is 'demo'";
|
||||
|
||||
const loginButton = document.createElement("button");
|
||||
loginButton.innerText = "login";
|
||||
loginButton.addEventListener('click', () => {
|
||||
login(passwordInput.value);
|
||||
})
|
||||
|
||||
loginForm.appendChild(passwordInput);
|
||||
loginForm.appendChild(loginButton);
|
||||
w.content.appendChild(loginForm);
|
||||
|
||||
w.close.remove();
|
||||
getScreenRoot().appendChild(w.window);
|
||||
promoteWindow(w);
|
||||
}
|
||||
Loading…
Reference in a new issue