From df808da5d64a27ba186e306a40923dfb614f5f25 Mon Sep 17 00:00:00 2001 From: Zonggao Li <23200179+li20034@users.noreply.github.com> Date: Fri, 14 Feb 2025 23:29:16 -0800 Subject: [PATCH] Fix password updated check --- server/service/auth/password.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/service/auth/password.go b/server/service/auth/password.go index 20efd14..16b6202 100644 --- a/server/service/auth/password.go +++ b/server/service/auth/password.go @@ -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, }) }