Fix password updated check

This commit is contained in:
Zonggao Li
2025-02-14 23:29:16 -08:00
parent 06bd869fb1
commit df808da5d6

View File

@@ -70,7 +70,9 @@ func (s *Service) IsPasswordUpdated(c *gin.Context) {
err = bcrypt.CompareHashAndPassword([]byte(account.Password), []byte("admin"))
rsp.OkRspWithData(c, &proto.IsPasswordUpdatedRsp{
IsUpdated: err == nil,
// If the hash is not valid, still assume it's not updated
// The error we want to see is password and hash not matching
IsUpdated: err == bcrypt.ErrMismatchedHashAndPassword,
})
}