Use errors.Is in Password.Match.
This commit is contained in:
+1
-1
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user