diff --git a/internal/glance/glance.go b/internal/glance/glance.go index 8db87e1..439e996 100644 --- a/internal/glance/glance.go +++ b/internal/glance/glance.go @@ -380,7 +380,7 @@ func (a *application) addressOfRequest(r *http.Request) string { } ips := strings.Split(forwardedFor, ",") - if len(ips) == 0 { + if len(ips) == 0 || ips[0] == "" { return remoteAddrWithoutPort() } diff --git a/internal/glance/static/js/login.js b/internal/glance/static/js/login.js index c359c61..e077fe9 100644 --- a/internal/glance/static/js/login.js +++ b/internal/glance/static/js/login.js @@ -94,6 +94,8 @@ async function handleLoginAttempt() { state.isLoading = false; if (response.status === 200) { + setTimeout(() => { window.location.href = pageData.baseURL + "/"; }, 300); + container.animate({ keyframes: [{ offset: 1, transform: "scale(0.95)", opacity: 0 }], options: { duration: 300, easing: "ease", fill: "forwards" }} @@ -103,8 +105,6 @@ async function handleLoginAttempt() { keyframes: [{ offset: 1, opacity: 0 }], options: { duration: 300, easing: "ease", fill: "forwards", delay: 50 } }); - - setTimeout(() => { window.location.href = pageData.baseURL + "/"; }, 300); } else if (response.status === 401) { errorMessage.text(lang.incorrectCredentials); passwordInput.focus();