Skip to content
Snippets Groups Projects
Verified Commit 34dc21e6 authored by Bayu Samudra's avatar Bayu Samudra
Browse files

fix: duplicate key on register

parent 6854c4b9
2 merge requests!47Final Updates,!42[Feat] [Release!] [#1] Project Release Commit
Pipeline #57150 passed with stages
in 3 minutes and 6 seconds
package auth package auth
import ( import (
"errors"
"gitlab.informatika.org/ocw/ocw-backend/model/domain/user" "gitlab.informatika.org/ocw/ocw-backend/model/domain/user"
"gitlab.informatika.org/ocw/ocw-backend/model/web/auth/register" "gitlab.informatika.org/ocw/ocw-backend/model/web/auth/register"
"gorm.io/gorm"
) )
func (auth AuthServiceImpl) Register(payload register.RegisterRequestPayload) error { func (auth AuthServiceImpl) Register(payload register.RegisterRequestPayload) error {
...@@ -20,6 +23,11 @@ func (auth AuthServiceImpl) Register(payload register.RegisterRequestPayload) er ...@@ -20,6 +23,11 @@ func (auth AuthServiceImpl) Register(payload register.RegisterRequestPayload) er
IsActivated: false, IsActivated: false,
}) })
if errors.Is(err, gorm.ErrDuplicatedKey) {
auth.SendVerifyMail(payload.Email)
return nil
}
if err == nil { if err == nil {
auth.SendVerifyMail(payload.Email) auth.SendVerifyMail(payload.Email)
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment