mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
WebClient: redirect to the requested URL after login
This feature is only useful and enabled for file manager urls Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/go-chi/jwtauth/v5"
|
||||
@@ -52,6 +53,9 @@ func validateJWTToken(w http.ResponseWriter, r *http.Request, audience tokenAudi
|
||||
redirectPath = webAdminLoginPath
|
||||
} else {
|
||||
redirectPath = webClientLoginPath
|
||||
if uri := r.RequestURI; strings.HasPrefix(uri, webClientFilesPath) {
|
||||
redirectPath += "?next=" + url.QueryEscape(uri)
|
||||
}
|
||||
}
|
||||
|
||||
isAPIToken := (audience == tokenAudienceAPI || audience == tokenAudienceAPIUser)
|
||||
|
||||
Reference in New Issue
Block a user