fixed login bug

This commit is contained in:
MathMan05 2024-08-19 11:32:21 -05:00
parent 1506521835
commit ec2fc491d9
2 changed files with 8 additions and 2 deletions

View file

@ -237,7 +237,7 @@ async function login(username, password, captcha) {
try {
const info = JSON.parse(localStorage.getItem("instanceinfo"));
const api = info.login + (info.login.startsWith("/") ? "/" : "");
return await fetch(api + 'auth/login', options).then(response => response.json())
return await fetch(api + '/auth/login', options).then(response => response.json())
.then((response) => {
console.log(response, response.message);
if ("Invalid Form Body" === response.message) {
@ -282,6 +282,8 @@ async function login(username, password, captcha) {
}
else {
console.warn(response);
if (!response.token)
return;
adduser({ serverurls: JSON.parse(localStorage.getItem("instanceinfo")), email: username, token: response.token }).username = username;
const redir = new URLSearchParams(window.location.search).get("goback");
if (redir) {
@ -296,6 +298,8 @@ async function login(username, password, captcha) {
}
else {
console.warn(response);
if (!response.token)
return;
adduser({ serverurls: JSON.parse(localStorage.getItem("instanceinfo")), email: username, token: response.token }).username = username;
const redir = new URLSearchParams(window.location.search).get("goback");
if (redir) {