1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

feat(user):logout after change password EE-1590 (#6267)

* fix(user) logout after password change
This commit is contained in:
sunportainer 2022-01-21 08:33:43 +08:00 committed by GitHub
parent 58de8e175f
commit 661f0aad49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 53 additions and 11 deletions

View file

@ -3,6 +3,7 @@ package users
import (
"errors"
"net/http"
"time"
"github.com/asaskevich/govalidator"
httperror "github.com/portainer/libhttp/error"
@ -99,6 +100,7 @@ func (handler *Handler) userUpdate(w http.ResponseWriter, r *http.Request) *http
if err != nil {
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to hash user password", errCryptoHashFailure}
}
user.TokenIssueAt = time.Now().Unix()
}
if payload.Role != 0 {
@ -116,6 +118,5 @@ func (handler *Handler) userUpdate(w http.ResponseWriter, r *http.Request) *http
// remove all of the users persisted API keys
handler.apiKeyService.InvalidateUserKeyCache(user.ID)
return response.JSON(w, user)
}