diff --git a/public/img/banner.png b/public/img/banner.png new file mode 100644 index 0000000..f618ad3 Binary files /dev/null and b/public/img/banner.png differ diff --git a/src/lib/common/ButtonClose.svelte b/src/lib/common/ButtonClose.svelte index 3bc89e4..065754c 100644 --- a/src/lib/common/ButtonClose.svelte +++ b/src/lib/common/ButtonClose.svelte @@ -1,13 +1,12 @@ - diff --git a/src/lib/login/loginmodal/LoginModal.svelte b/src/lib/login/loginmodal/LoginModal.svelte index 89c06ab..e9cca94 100644 --- a/src/lib/login/loginmodal/LoginModal.svelte +++ b/src/lib/login/loginmodal/LoginModal.svelte @@ -7,49 +7,37 @@ export let options; - let offlineUsername = ""; + let offlineUsername; + let microsoftCode = null; - function handleOfflineLoginClick(e) { + async function handleOfflineLoginClick(e) { if (offlineUsername.length > 16 || offlineUsername.length < 1) { alert("Username must be between 1 and 16 characters long."); return; } - let usernameRegex = /^[a-zA-Z0-9_]+$/; + const usernameRegex = /^[a-zA-Z0-9_]+$/; if (!usernameRegex.test(offlineUsername)) { alert("Username can only contain letters, numbers, and underscores."); return; } - invoke("login_offline", { username: offlineUsername }) - .then((accountData) => { - console.debug("login_offline", accountData) - - options.currentAccount = accountData; - options.store(); - }) - .catch(e => console.error(e)); + const accountData = await invoke("login_offline", { username: offlineUsername }); + options.currentAccount = accountData; + options.store(); } - function handleMicrosoftLoginClick(event) { - invoke("login_microsoft") - .then((account) => { - console.debug("microsoft authentication successful", account); - - options.currentAccount = account; - options.store(); - }) - .catch(e => { - console.error("microsoft authentication error", e); - alert(e); - }); + async function handleMicrosoftLoginClick(e) { + try { + const accountData = await invoke("login_microsoft"); + options.currentAccount = accountData; + options.store(); + } catch (err) { + alert(err); + } } - let microsoftCode; - listen("microsoft_code", (e) => { - console.debug("microsoft_code", e.payload); - microsoftCode = e.payload; }); @@ -63,7 +51,7 @@