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:
parent
ff07f02716
commit
1a29c1568c
4 changed files with 19 additions and 1 deletions
|
@ -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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue