(pwdStaticHash string)
| 84 | } |
| 85 | |
| 86 | func (u *User) ValidatePwdStaticHash(pwdStaticHash string) error { |
| 87 | if pwdStaticHash == "" { |
| 88 | return errors.WithStack(errs.EmptyPassword) |
| 89 | } |
| 90 | if u.PwdHash != HashPwd(pwdStaticHash, u.Salt) { |
| 91 | return errors.WithStack(errs.WrongPassword) |
| 92 | } |
| 93 | return nil |
| 94 | } |
| 95 | |
| 96 | func (u *User) SetPassword(pwd string) *User { |
| 97 | u.Salt = random.String(16) |
no test coverage detected