1
Fork 0

Use errors.Is in Password.Match.

This commit is contained in:
Juliusz Chroboczek 2024-05-27 23:00:45 +02:00
parent 90a0a2e318
commit f802075aa8
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ func (p Password) Match(pw string) (bool, error) {
return false, errors.New("missing key")
}
err := bcrypt.CompareHashAndPassword([]byte(*p.Key), []byte(pw))
if err == bcrypt.ErrMismatchedHashAndPassword {
if errors.Is(err, bcrypt.ErrMismatchedHashAndPassword) {
return false, nil
}
return err == nil, err