refactor: delete all the users email verifications after a successful verification

This commit is contained in:
Derrick Hammer 2024-02-26 10:39:09 -05:00
parent 036520581f
commit 92c33e0af5
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 1 deletions

View File

@ -182,8 +182,15 @@ func (s AccountServiceDefault) VerifyEmail(email string, token string) error {
}
}
return nil
verification = models.EmailVerification{
UserID: verification.UserID,
}
if result := s.db.Where(&verification).Delete(&verification); result.Error != nil {
return NewAccountError(ErrKeyDatabaseOperationFailed, result.Error)
}
return nil
}
func (s AccountServiceDefault) UpdateAccountName(userId uint, firstName string, lastName string) error {