MCPcopy
hub / github.com/OpenListTeam/OpenList / ValidatePwdStaticHash

Method ValidatePwdStaticHash

internal/model/user.go:86–94  ·  view source on GitHub ↗
(pwdStaticHash string)

Source from the content-addressed store, hash-verified

84}
85
86func (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
96func (u *User) SetPassword(pwd string) *User {
97 u.Salt = random.String(16)

Callers 2

ValidateRawPasswordMethod · 0.95
loginHashFunction · 0.80

Calls 1

HashPwdFunction · 0.85

Tested by

no test coverage detected