build(backend): upgrade golangci-lint to 1.46.2 (#1991)
This commit is contained in:
12
http/auth.go
12
http/auth.go
@@ -33,7 +33,7 @@ type userInfo struct {
|
||||
|
||||
type authToken struct {
|
||||
User userInfo `json:"user"`
|
||||
jwt.StandardClaims
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
type extractor []string
|
||||
@@ -74,8 +74,8 @@ func withUser(fn handleFunc) handleFunc {
|
||||
return http.StatusUnauthorized, nil
|
||||
}
|
||||
|
||||
expired := !tk.VerifyExpiresAt(time.Now().Add(time.Hour).Unix(), true)
|
||||
updated := d.store.Users.LastUpdate(tk.User.ID) > tk.IssuedAt
|
||||
expired := !tk.VerifyExpiresAt(time.Now().Add(time.Hour), true)
|
||||
updated := tk.IssuedAt != nil && tk.IssuedAt.Unix() < d.store.Users.LastUpdate(tk.User.ID)
|
||||
|
||||
if expired || updated {
|
||||
w.Header().Add("X-Renew-Token", "true")
|
||||
@@ -187,9 +187,9 @@ func printToken(w http.ResponseWriter, _ *http.Request, d *data, user *users.Use
|
||||
HideDotfiles: user.HideDotfiles,
|
||||
DateFormat: user.DateFormat,
|
||||
},
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
IssuedAt: time.Now().Unix(),
|
||||
ExpiresAt: time.Now().Add(TokenExpirationTime).Unix(),
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
IssuedAt: jwt.NewNumericDate(time.Now()),
|
||||
ExpiresAt: jwt.NewNumericDate(time.Now().Add(TokenExpirationTime)),
|
||||
Issuer: "File Browser",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@ import (
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/filebrowser/filebrowser/v2/errors"
|
||||
"github.com/filebrowser/filebrowser/v2/users"
|
||||
@@ -176,7 +177,7 @@ var userPutHandler = withSelfOrAdmin(func(w http.ResponseWriter, r *http.Request
|
||||
}
|
||||
|
||||
for k, v := range req.Which {
|
||||
v = strings.Title(v)
|
||||
v = cases.Title(language.English).String(v)
|
||||
req.Which[k] = v
|
||||
|
||||
if v == "Password" {
|
||||
|
||||
Reference in New Issue
Block a user