fix: apply backend lint
This commit is contained in:
parent
ea3c4dbf1c
commit
9d6f86a90f
@ -11,9 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type modifyRequest struct {
|
type modifyRequest struct {
|
||||||
What string `json:"what"` // Answer to: what data type?
|
What string `json:"what"` // Answer to: what data type?
|
||||||
Which []string `json:"which"` // Answer to: which fields?
|
Which []string `json:"which"` // Answer to: which fields?
|
||||||
Current_Password string `json:"current_password"` // Answer to: user logged password
|
CurrentPassword string `json:"current_password"` // Answer to: user logged password
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHandler(
|
func NewHandler(
|
||||||
|
|||||||
@ -119,7 +119,7 @@ var userPostHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *
|
|||||||
}
|
}
|
||||||
|
|
||||||
if d.settings.AuthMethod == auth.MethodJSONAuth {
|
if d.settings.AuthMethod == auth.MethodJSONAuth {
|
||||||
if !users.CheckPwd(req.modifyRequest.Current_Password, d.user.Password) {
|
if !users.CheckPwd(req.CurrentPassword, d.user.Password) {
|
||||||
return http.StatusBadRequest, fberrors.ErrCurrentPasswordIncorrect
|
return http.StatusBadRequest, fberrors.ErrCurrentPasswordIncorrect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,9 +171,9 @@ var userPutHandler = withSelfOrAdmin(func(w http.ResponseWriter, r *http.Request
|
|||||||
"perm": {},
|
"perm": {},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, field := range req.modifyRequest.Which {
|
for _, field := range req.Which {
|
||||||
if _, ok := sensibleFields[field]; ok {
|
if _, ok := sensibleFields[field]; ok {
|
||||||
if !users.CheckPwd(req.modifyRequest.Current_Password, d.user.Password) {
|
if !users.CheckPwd(req.CurrentPassword, d.user.Password) {
|
||||||
return http.StatusBadRequest, fberrors.ErrCurrentPasswordIncorrect
|
return http.StatusBadRequest, fberrors.ErrCurrentPasswordIncorrect
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user