MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / VerifyPassword

Method VerifyPassword

internal/domain/user.go:87–92  ·  view source on GitHub ↗

VerifyPassword 验证密码是否匹配

(password string)

Source from the content-addressed store, hash-verified

85
86// VerifyPassword 验证密码是否匹配
87func (u *User) VerifyPassword(password string) error {
88 if err := bcrypt.CompareHashAndPassword([]byte(u.Password), []byte(password)); err != nil {
89 return ErrPasswordMismatch
90 }
91 return nil
92}
93
94// HashPassword 对密码进行哈希处理
95func (u *User) HashPassword() error {

Callers 3

LoginMethod · 0.80
ChangePasswordMethod · 0.80
DeleteUserMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected