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

feat: adding mail verification

parent f3f93b9f
3 merge requests!13Staging,!9Feat/s1 sb4 implement register api,!7Adding Mailing and Register
Pipeline #51690 passed with stage
in 2 minutes and 26 seconds
......@@ -2,6 +2,7 @@ package auth
import (
"gitlab.informatika.org/ocw/ocw-backend/repository/user"
"gitlab.informatika.org/ocw/ocw-backend/service/verification"
"gitlab.informatika.org/ocw/ocw-backend/utils/env"
"gitlab.informatika.org/ocw/ocw-backend/utils/password"
"gitlab.informatika.org/ocw/ocw-backend/utils/token"
......@@ -12,4 +13,5 @@ type AuthServiceImpl struct {
password.PasswordUtil
*env.Environment
token.TokenUtil
verification.VerificationService
}
......@@ -6,11 +6,17 @@ import (
)
func (auth AuthServiceImpl) Register(payload register.RegisterRequestPayload) error {
return auth.UserRepository.Add(user.User{
err := auth.UserRepository.Add(user.User{
Email: payload.Email,
Password: payload.Password,
Name: payload.Name,
Role: user.Student,
IsActivated: false,
})
if err == nil {
auth.SendVerifyMail(payload.Email)
}
return err
}
......@@ -7,6 +7,7 @@ import (
"gitlab.informatika.org/ocw/ocw-backend/service/logger"
"gitlab.informatika.org/ocw/ocw-backend/service/logger/hooks"
"gitlab.informatika.org/ocw/ocw-backend/service/reporter"
"gitlab.informatika.org/ocw/ocw-backend/service/verification"
)
var ServiceTestSet = wire.NewSet(
......@@ -27,6 +28,12 @@ var ServiceTestSet = wire.NewSet(
wire.Struct(new(auth.AuthServiceImpl), "*"),
wire.Bind(new(auth.AuthService), new(*auth.AuthServiceImpl)),
),
// verification service
wire.NewSet(
wire.Struct(new(verification.VerificationServiceImpl), "*"),
wire.Bind(new(verification.VerificationService), new(*verification.VerificationServiceImpl)),
),
)
var ServiceSet = wire.NewSet(
......
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