feat: auth redirect

This commit is contained in:
2025-03-18 17:46:54 -04:00
parent 86b74e0ebc
commit be0981f7b7
2 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import (
"fmt"
"log"
"net/http"
"net/url"
"strconv"
"strings"
@ -62,7 +63,8 @@ func WithAuthRedirect(next http.Handler, key string) http.Handler {
}
// Redirect if not authenticated
http.Redirect(w, r, "/auth", http.StatusFound)
pathRedir := url.QueryEscape(r.URL.Path)
http.Redirect(w, r, fmt.Sprintf("/auth?redir=%s", pathRedir), http.StatusFound)
}
})
}