MCPcopy Index your code
hub / github.com/coder/coder / Validate

Function Validate

coderd/userpassword/userpassword.go:140–151  ·  view source on GitHub ↗

Validate checks that the plain text password meets the minimum password requirements. It returns properly formatted errors for detailed form validation on the client.

(password string)

Source from the content-addressed store, hash-verified

138// Validate checks that the plain text password meets the minimum password requirements.
139// It returns properly formatted errors for detailed form validation on the client.
140func Validate(password string) error {
141 // Ensure passwords are secure enough!
142 // See: https://github.com/wagslane/go-password-validator#what-entropy-value-should-i-use
143 err := passwordvalidator.Validate(password, 52)
144 if err != nil {
145 return err
146 }
147 if len(password) > 64 {
148 return xerrors.Errorf("password must be no more than %d characters", 64)
149 }
150 return nil
151}

Callers 6

postFirstUserMethod · 0.92
postUserMethod · 0.92
putUserPasswordMethod · 0.92
validateUserPasswordMethod · 0.92
TestUserPasswordValidateFunction · 0.92

Calls 2

ValidateMethod · 0.65
ErrorfMethod · 0.45

Tested by 1

TestUserPasswordValidateFunction · 0.74