39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
const version = document.querySelector("#version")
|
|
const information = document.querySelector(".information")
|
|
|
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
version.innerText = `Launcher ${await system.call("launcher::version")}`
|
|
})
|
|
|
|
function showInformation() {
|
|
return information.removeAttribute("hidden")
|
|
}
|
|
|
|
function hideInformation() {
|
|
return information.setAttribute("hidden", "")
|
|
}
|
|
|
|
async function login() {
|
|
const username = document.querySelector("#username").value
|
|
const password = document.querySelector("#password").value
|
|
const result = await system.call("auth::lentia", { username, password })
|
|
if (result.success == false) {
|
|
await system.call("dialog::error", {
|
|
title: result.error.error,
|
|
message: result.error.errorMessage
|
|
})
|
|
}
|
|
}
|
|
|
|
function clearPassword() {
|
|
password.value = ""
|
|
}
|
|
|
|
function requestLoginWithOAuth2() {
|
|
showFrame("oauth2")
|
|
hideInformation()
|
|
showLoadingBar()
|
|
}
|
|
|
|
hideLoadingBar()
|
|
showFrame("provider") |