Compare commits

..

No commits in common. "ea5a97c6137da57ef34aa923fddc11fe2a4638d2" and "12a9ad28fdbea9b55da3b9a7f047f6407c2b50e0" have entirely different histories.

2 changed files with 4 additions and 14 deletions

View File

@ -134,10 +134,6 @@ func (s AccountServiceDefault) SendEmailVerification(userId uint) error {
return err
}
if user.Verified {
return NewAccountError(ErrKeyAccountAlreadyVerified, nil)
}
token := GenerateSecurityToken()
var verification models.EmailVerification
@ -202,7 +198,7 @@ func (s AccountServiceDefault) VerifyEmail(email string, token string) error {
if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
return NewAccountError(ErrKeyEmailVerificationFailed, result.Error)
return NewAccountError(ErrKeyUserNotFound, result.Error)
}
return NewAccountError(ErrKeyDatabaseOperationFailed, result.Error)

View File

@ -25,9 +25,7 @@ const (
ErrKeyHashingFailed = "ErrHashingFailed"
// Account update errors
ErrKeyAccountUpdateFailed = "ErrAccountUpdateFailed"
ErrKeyAccountAlreadyVerified = "ErrAccountAlreadyVerified"
ErrKeyEmailVerificationFailed = "ErrEmailVerificationFailed"
ErrKeyAccountUpdateFailed = "ErrAccountUpdateFailed"
// JWT generation errors
ErrKeyJWTGenerationFailed = "ErrJWTGenerationFailed"
@ -74,9 +72,7 @@ var defaultErrorMessages = map[string]string{
ErrKeyLoginFailed: "Login failed due to an internal error.",
// Account update errors
ErrKeyAccountUpdateFailed: "Failed to update account information.",
ErrKeyAccountAlreadyVerified: "Account is already verified.",
ErrKeyEmailVerificationFailed: "Failed to verify email address.",
ErrKeyAccountUpdateFailed: "Failed to update account information.",
// JWT generation errors
ErrKeyJWTGenerationFailed: "Failed to generate a new JWT token.",
@ -122,9 +118,7 @@ var (
ErrKeyLoginFailed: http.StatusInternalServerError,
// Account update errors
ErrKeyAccountUpdateFailed: http.StatusInternalServerError,
ErrKeyAccountAlreadyVerified: http.StatusConflict,
ErrKeyEmailVerificationFailed: http.StatusInternalServerError,
ErrKeyAccountUpdateFailed: http.StatusInternalServerError,
// JWT generation errors
ErrKeyJWTGenerationFailed: http.StatusInternalServerError,