Refactor; Fix CORS when login via passkeys
Some checks are pending
Build and Upload Binary / build (x86_64-unknown-linux-musl-rust-auth, auth, x86, stable, x86_64-unknown-linux-musl) (push) Waiting to run

This commit is contained in:
mortis-0 2024-03-16 20:03:37 +08:00
parent 3798e573b6
commit 1831720b24

View File

@ -113,11 +113,17 @@
.then(async (response) => { .then(async (response) => {
if (response.ok){ if (response.ok){
console.log("Logged In!"); console.log("Logged In!");
var redir = await response.json(); try {
if(redir && redir.status === "ok"){ var redir = await response.json();
console.log("Redirecting"); if(redir && redir.status === "ok"){
window.location.replace(redir.redirect); console.log("Redirecting");
} else { window.location.replace(redir.redirect);
} else {
window.location.replace("/");
}
} catch (e) {
console.log(e);
window.alert('Login Success');
window.location.replace("/"); window.location.replace("/");
} }
} else { } else {