From f8e421a06820890eecd703cfdf9f338a7de92708 Mon Sep 17 00:00:00 2001 From: monsieurswag Date: Tue, 3 Dec 2024 14:58:49 +0100 Subject: [PATCH] Fix startup tests --- .github/workflows/startup-tests.yml | 4 ++-- frontend/src/routes/(authentication)/login/+page.server.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/startup-tests.yml b/.github/workflows/startup-tests.yml index 5c9df478c..09e22f356 100644 --- a/.github/workflows/startup-tests.yml +++ b/.github/workflows/startup-tests.yml @@ -137,7 +137,7 @@ jobs: working-directory: ${{ env.frontend-directory }} run: | response=$(curl -d "username=admin@tests.com&password=1234" -H "Origin: https://localhost:8443" https://localhost:8443/login\?/login -k) - server_reponse='{"type":"redirect","status":302,"location":"/?refresh=1"}' + server_reponse='{"type":"redirect","status":302,"location":"/"}' echo "[SERVER_RESPONSE] $response" echo "[EXPECTED_RESPONSE] $server_reponse" if [[ "$response" == "$server_reponse" ]]; then @@ -268,7 +268,7 @@ jobs: working-directory: ${{ env.frontend-directory }} run: | response=$(curl -d "username=admin@tests.com&password=1234" -H "Origin: https://localhost:8443" https://localhost:8443/login\?/login -k) - server_reponse='{"type":"redirect","status":302,"location":"/?refresh=1"}' + server_reponse='{"type":"redirect","status":302,"location":"/"}' echo "[SERVER_RESPONSE] $response" echo "[EXPECTED_RESPONSE] $server_reponse" if [[ "$response" == "$server_reponse" ]]; then diff --git a/frontend/src/routes/(authentication)/login/+page.server.ts b/frontend/src/routes/(authentication)/login/+page.server.ts index 92b7d3b40..0f0611bfb 100644 --- a/frontend/src/routes/(authentication)/login/+page.server.ts +++ b/frontend/src/routes/(authentication)/login/+page.server.ts @@ -28,9 +28,9 @@ interface AuthenticationFlow { } function makeRedirectURL(currentLang: string, preferedLang: string, url: URL): string { - const next = url.searchParams.get('next') || '/'; - const secureNext = getSecureRedirect(next); - if (currentLang == preferedLang) { + const next = url.searchParams.get('next'); + const secureNext = getSecureRedirect(next) || '/'; + if (currentLang === preferedLang) { return secureNext; } return secureNext ? `${secureNext}?refresh=1` : `/?refresh=1`;