Fixed messed up stuff

This commit is contained in:
Anthony 2022-11-24 15:50:59 +00:00
parent bad1c5b8d7
commit 9198b48517
2 changed files with 6 additions and 6 deletions

View File

@ -112,10 +112,10 @@ async function prepareLoginModal(register: boolean) {
<button type="button" id="account-register" class="btn btn-primary">Register</button> <button type="button" id="account-register" class="btn btn-primary">Register</button>
<button type="submit" id="account-login" class="btn btn-primary">Login</button> <button type="submit" id="account-login" class="btn btn-primary">Login</button>
` `
document.getElementById('account-register')!.addEventListener('click', () => prepareLoginModal(true))
} }
document.querySelector<HTMLDivElement>('#account-username-fill')!.hidden = !register document.querySelector<HTMLDivElement>('#account-username-fill')!.hidden = !register
document.querySelector<HTMLDivElement>('#account-confirm-password-fill')!.hidden = !register document.querySelector<HTMLDivElement>('#account-confirm-password-fill')!.hidden = !register
document.getElementById('account-register')!.addEventListener('click', () => prepareLoginModal(true))
document.getElementById('account-login')!.addEventListener('click', async () => { document.getElementById('account-login')!.addEventListener('click', async () => {
await pb.collection('users').authWithPassword((<HTMLInputElement>document.getElementById('account-email')!).value, (<HTMLInputElement>document.getElementById('account-password')!).value).catch((err) => { await pb.collection('users').authWithPassword((<HTMLInputElement>document.getElementById('account-email')!).value, (<HTMLInputElement>document.getElementById('account-password')!).value).catch((err) => {
$('#verification-alert').html(` $('#verification-alert').html(`

View File

@ -26,7 +26,7 @@ pb.collection('users').authWithOAuth2(
} }
).then(() => { ).then(() => {
// document.getElementById('content').innerText = JSON.stringify(authData, null, 2); // document.getElementById('content').innerText = JSON.stringify(authData, null, 2);
new Location().assign('/') window.location.href = '/'
}).catch((err) => { }).catch((err) => {
document.getElementById('content')!.innerText = "Failed to exchange code.\n" + err document.getElementById('content')!.innerText = "Failed to exchange code.\n" + err
}) })