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:
parent
58de8e175f
commit
661f0aad49
8 changed files with 53 additions and 11 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue