mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
Add CredManager.
This commit is contained in:
@ -18,6 +18,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/casbin/casdoor/cred"
|
||||
"github.com/casbin/casdoor/util"
|
||||
)
|
||||
|
||||
@ -32,7 +33,9 @@ func (user *User) UpdateUserHash() {
|
||||
}
|
||||
|
||||
func (user *User) UpdateUserPassword(organization *Organization) {
|
||||
if organization.PasswordType == "salt" {
|
||||
user.Password = getSaltedPassword(user.Password, organization.PasswordSalt)
|
||||
credManager := cred.GetCredManager(organization.PasswordType)
|
||||
if credManager != nil {
|
||||
sealedPassword := credManager.GetSealedPassword(user.Password, user.PasswordSalt, organization.PasswordSalt)
|
||||
user.Password = sealedPassword
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user