fix: apply backend lint

This commit is contained in:
ArielLeyva 2025-12-20 09:10:54 -05:00
parent ea3c4dbf1c
commit 9d6f86a90f
2 changed files with 6 additions and 6 deletions

View File

@ -11,9 +11,9 @@ import (
)
type modifyRequest struct {
What string `json:"what"` // Answer to: what data type?
Which []string `json:"which"` // Answer to: which fields?
Current_Password string `json:"current_password"` // Answer to: user logged password
What string `json:"what"` // Answer to: what data type?
Which []string `json:"which"` // Answer to: which fields?
CurrentPassword string `json:"current_password"` // Answer to: user logged password
}
func NewHandler(

View File

@ -119,7 +119,7 @@ var userPostHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *
}
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
}
}
@ -171,9 +171,9 @@ var userPutHandler = withSelfOrAdmin(func(w http.ResponseWriter, r *http.Request
"perm": {},
}
for _, field := range req.modifyRequest.Which {
for _, field := range req.Which {
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
}
break