Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/handler/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ func (u user) VerifyEmail(c echo.Context) error {

err := u.verificationService.SendEmailVerification(userId, email)
if err != nil {
if strings.Contains(err.Error(), "email already verified") {
return Conflict(c)
}

LogStringError(c, err, "user: email verification")
return InternalError(c, "Unable to send email verification")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/verification.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (v verification) SendEmailVerification(userID, email string) error {

contact, _ := v.repos.Contact.GetByData(email)
if contact.Status == "validated" {
return common.StringError(errors.New("email is already authenticated"))
return common.StringError(errors.New("email already verified"))
}

// Encrypt required data to Base64 string and insert it in an email hyperlink
Expand Down