1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-10-05 19:31:01 +00:00

feat(ui): redirect back to original page after logging in

This commit is contained in:
Devon 2025-09-26 23:20:34 -04:00 committed by GitHub
parent ff07f02716
commit 1a29c1568c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import (
"errors"
"log/slog"
"net/http"
"net/url"
"miniflux.app/v2/internal/config"
"miniflux.app/v2/internal/crypto"
@ -42,7 +43,11 @@ func (m *middleware) handleUserSession(next http.Handler) http.Handler {
slog.Debug("Redirecting to login page because no user session has been found",
slog.String("url", r.RequestURI),
)
html.Redirect(w, r, route.Path(m.router, "login"))
loginURL, _ := url.Parse(route.Path(m.router, "login"))
values := loginURL.Query()
values.Set("redirect_url", r.RequestURI)
loginURL.RawQuery = values.Encode()
html.Redirect(w, r, loginURL.String())
}
} else {
slog.Debug("User session found",