ValidateAndHashPwd validates and hashes a password.
(password string, minimumLength uint)
| 11 | |
| 12 | // ValidateAndHashPwd validates and hashes a password. |
| 13 | func ValidateAndHashPwd(password string, minimumLength uint) (string, error) { |
| 14 | if uint(len(password)) < minimumLength { |
| 15 | return "", fberrors.ErrShortPassword{MinimumLength: minimumLength} |
| 16 | } |
| 17 | |
| 18 | if _, ok := commonPasswords[password]; ok { |
| 19 | return "", fberrors.ErrEasyPassword |
| 20 | } |
| 21 | |
| 22 | return HashPwd(password) |
| 23 | } |
| 24 | |
| 25 | // HashPwd hashes a password. |
| 26 | func HashPwd(password string) (string, error) { |
no test coverage detected