1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-09 18:25:58 +01:00

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

View file

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