feat: Policy check (#149)

* check password complexity policy

* check password complexity policy

* fix tests

* Update internal/admin/repository/eventsourcing/setup/setup.go

Co-authored-by: Livio Amstutz <[email protected]>

* changes for mr

Co-authored-by: Livio Amstutz <[email protected]>
This commit is contained in:
Fabi
2020-05-29 08:44:01 +02:00
committed by GitHub
co-authored by Livio Amstutz
parent 5a7d44327e
commit a4c7b39552
15 changed files with 477 additions and 61 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
package model
import (
policy_model "github.com/caos/zitadel/internal/policy/model"
"time"
"github.com/caos/zitadel/internal/crypto"
@@ -85,9 +86,9 @@ func (u *User) IsOTPReady() bool {
return u.OTP != nil && u.OTP.State == MFASTATE_READY
}
func (u *User) HashPasswordIfExisting(passwordAlg crypto.HashAlgorithm, onetime bool) error {
func (u *User) HashPasswordIfExisting(policy *policy_model.PasswordComplexityPolicy, passwordAlg crypto.HashAlgorithm, onetime bool) error {
if u.Password != nil {
return u.Password.HashPasswordIfExisting(passwordAlg, onetime)
return u.Password.HashPasswordIfExisting(policy, passwordAlg, onetime)
}
return nil
}