mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 23:20:24 +00:00
ensure to always validate password strength
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
9ba468698b
commit
af4f54bf11
1 changed files with 5 additions and 0 deletions
|
@ -1882,6 +1882,11 @@ func AddUser(user *User, executor, ipAddress string) error {
|
|||
|
||||
// UpdateUserPassword updates the user password
|
||||
func UpdateUserPassword(username, plainPwd, executor, ipAddress string) error {
|
||||
if config.PasswordValidation.Users.MinEntropy > 0 {
|
||||
if err := passwordvalidator.Validate(plainPwd, config.PasswordValidation.Users.MinEntropy); err != nil {
|
||||
return util.NewValidationError(err.Error())
|
||||
}
|
||||
}
|
||||
hashedPwd, err := hashPlainPassword(plainPwd)
|
||||
if err != nil {
|
||||
return util.NewGenericError(fmt.Sprintf("unable to set the new password: %v", err))
|
||||
|
|
Loading…
Reference in a new issue