updated to use new hws version
This commit is contained in:
@@ -19,15 +19,12 @@ func (auth *Authenticator[T, TX]) LoginReq(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
_, ok := getAuthorizedModel[T](r.Context())
|
||||
if !ok {
|
||||
err := auth.server.ThrowError(w, r, hws.HWSError{
|
||||
auth.server.ThrowError(w, r, hws.HWSError{
|
||||
Error: errors.New("Login required"),
|
||||
Message: "Please login to view this page",
|
||||
StatusCode: http.StatusUnauthorized,
|
||||
RenderErrorPage: true,
|
||||
})
|
||||
if err != nil {
|
||||
auth.server.ThrowFatal(w, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
next.ServeHTTP(w, r)
|
||||
@@ -66,15 +63,12 @@ func (auth *Authenticator[T, TX]) FreshReq(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
model, ok := getAuthorizedModel[T](r.Context())
|
||||
if !ok {
|
||||
err := auth.server.ThrowError(w, r, hws.HWSError{
|
||||
auth.server.ThrowError(w, r, hws.HWSError{
|
||||
Error: errors.New("Login required"),
|
||||
Message: "Please login to view this page",
|
||||
StatusCode: http.StatusUnauthorized,
|
||||
RenderErrorPage: true,
|
||||
})
|
||||
if err != nil {
|
||||
auth.server.ThrowFatal(w, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
isFresh := time.Now().Before(time.Unix(model.fresh, 0))
|
||||
|
||||
Reference in New Issue
Block a user