userpage: fix login saving, url rewriting on subpath

Fixes #437.
This commit is contained in:
Harvey Tindall
2025-11-27 18:10:28 +00:00
parent ab5a82858e
commit 1296992752
2 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ interface userWindow extends GlobalWindow {
declare var window: userWindow; declare var window: userWindow;
// const basePath = window.location.pathname.replace("/password/reset", ""); // const basePath = window.location.pathname.replace("/password/reset", "");
const basePath = window.pages.MyAccount; const basePath = window.pages.Base + window.pages.MyAccount;
const theme = new ThemeManager(document.getElementById("button-theme")); const theme = new ThemeManager(document.getElementById("button-theme"));
+3 -4
View File
@@ -2,7 +2,6 @@ package main
import ( import (
"fmt" "fmt"
"strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
lm "github.com/hrfee/jfa-go/logmessages" lm "github.com/hrfee/jfa-go/logmessages"
@@ -68,9 +67,9 @@ func (app *appContext) getUserTokenLogin(gc *gin.Context) {
host := app.ExternalDomainNoPort(gc) host := app.ExternalDomainNoPort(gc)
uri := "/my" uri := "/my"
// FIXME: This seems like a bad idea? I think it's to deal with people having Reverse proxy subfolder/URL base set to /accounts. // FIXME: This seems like a bad idea? I think it's to deal with people having Reverse proxy subfolder/URL base set to /accounts.
if strings.HasPrefix(gc.Request.RequestURI, PAGES.Base) { // if strings.HasPrefix(gc.Request.RequestURI, PAGES.Base) {
uri = "/accounts/my" // uri = "/accounts/my"
} // }
gc.SetCookie("user-refresh", refresh, REFRESH_TOKEN_VALIDITY_SEC, uri, host, true, true) gc.SetCookie("user-refresh", refresh, REFRESH_TOKEN_VALIDITY_SEC, uri, host, true, true)
gc.JSON(200, getTokenDTO{token}) gc.JSON(200, getTokenDTO{token})
} }