Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: login fallback error #19537

Merged
merged 9 commits into from
Dec 23, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
</div>
<img
class="logo"
src="/dhis-web-commons/security/logo_front.png"
src="./dhis-web-commons/security/logo_front.png"
alt="DHIS2 Logo"
/>
</div>
Expand Down Expand Up @@ -328,7 +328,7 @@ <h1>Log in</h1>
// Fetch the login configuration dynamically
async function fetchLoginConfig() {
try {
const response = await fetch("../api/loginConfig");
const response = await fetch("./api/loginConfig");

if (!response.ok) {
let errorMessage = "Login failed: " + response.status;
Expand All @@ -351,7 +351,7 @@ <h1>Log in</h1>
config.applicationDescription || "Welcome to the DHIS2 application";
if (config.countryFlag) {
const flag = document.getElementById("flag");
flag.src = `/dhis-web-commons/flags/${config.countryFlag}.png`;
flag.src = `./dhis-web-commons/flags/${config.countryFlag}.png`;
flag.style.display = "block";
}
} catch (error) {
Expand Down Expand Up @@ -400,7 +400,7 @@ <h1>Log in</h1>
}

try {
const response = await fetch("../api/auth/login", {
const response = await fetch("./api/auth/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
Expand All @@ -425,7 +425,7 @@ <h1>Log in</h1>
const user = await response.json();

if (user.loginStatus === "SUCCESS") {
const redirectUrl = user.redirectUrl || "/";
const redirectUrl = user.redirectUrl || "./";
window.location.href = redirectUrl;
} else {
throw new Error("Login failed. Status: " + user.loginStatus);
Expand Down
Loading