From 5c6224222f2a0eb18bd4f9bb8cc68916272a1a7d Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 26 Feb 2024 10:30:22 -0500 Subject: [PATCH] fix: only update user if we aren't yet verified --- account/account.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/account/account.go b/account/account.go index 4e91787..af0bb72 100644 --- a/account/account.go +++ b/account/account.go @@ -159,9 +159,11 @@ func (s AccountServiceDefault) VerifyEmail(email string, token string) error { return NewAccountError(ErrKeySecurityInvalidToken, nil) } - err := s.updateAccountInfo(verification.UserID, models.User{Verified: true}) - if err != nil { - return err + if !verification.User.Verified { + err := s.updateAccountInfo(verification.UserID, models.User{Verified: true}) + if err != nil { + return err + } } return nil