VerifyPassword 验证密码是否匹配
(password string)
| 85 | |
| 86 | // VerifyPassword 验证密码是否匹配 |
| 87 | func (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 对密码进行哈希处理 |
| 95 | func (u *User) HashPassword() error { |
no outgoing calls
no test coverage detected