fix: add events for signup
This commit is contained in:
parent
b028be3cbc
commit
a8503666e3
|
@ -260,6 +260,8 @@ func OAuthCallbackHandler() gin.HandlerFunc {
|
||||||
go func() {
|
go func() {
|
||||||
if isSignUp {
|
if isSignUp {
|
||||||
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, provider, user)
|
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, provider, user)
|
||||||
|
// User is also logged in with signup
|
||||||
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, provider, user)
|
||||||
} else {
|
} else {
|
||||||
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, provider, user)
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, provider, user)
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,6 +175,8 @@ func VerifyEmailHandler() gin.HandlerFunc {
|
||||||
go func() {
|
go func() {
|
||||||
if isSignUp {
|
if isSignUp {
|
||||||
utils.RegisterEvent(c, constants.UserSignUpWebhookEvent, loginMethod, user)
|
utils.RegisterEvent(c, constants.UserSignUpWebhookEvent, loginMethod, user)
|
||||||
|
// User is also logged in with signup
|
||||||
|
utils.RegisterEvent(c, constants.UserLoginWebhookEvent, loginMethod, user)
|
||||||
} else {
|
} else {
|
||||||
utils.RegisterEvent(c, constants.UserLoginWebhookEvent, loginMethod, user)
|
utils.RegisterEvent(c, constants.UserLoginWebhookEvent, loginMethod, user)
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,7 @@ func MobileSignupResolver(ctx context.Context, params *model.MobileSignUpInput)
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
smsproviders.SendSMS(mobile, smsBody.String())
|
smsproviders.SendSMS(mobile, smsBody.String())
|
||||||
|
utils.RegisterEvent(ctx, constants.UserCreatedWebhookEvent, constants.AuthRecipeMethodBasicAuth, user)
|
||||||
}()
|
}()
|
||||||
return &model.AuthResponse{
|
return &model.AuthResponse{
|
||||||
Message: "Please check the OTP in your inbox",
|
Message: "Please check the OTP in your inbox",
|
||||||
|
@ -298,6 +299,8 @@ func MobileSignupResolver(ctx context.Context, params *model.MobileSignUpInput)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, constants.AuthRecipeMethodMobileBasicAuth, user)
|
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, constants.AuthRecipeMethodMobileBasicAuth, user)
|
||||||
|
// User is also logged in with signup
|
||||||
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, constants.AuthRecipeMethodMobileBasicAuth, user)
|
||||||
db.Provider.AddSession(ctx, &models.Session{
|
db.Provider.AddSession(ctx, &models.Session{
|
||||||
UserID: user.ID,
|
UserID: user.ID,
|
||||||
UserAgent: utils.GetUserAgent(gc.Request),
|
UserAgent: utils.GetUserAgent(gc.Request),
|
||||||
|
|
|
@ -301,6 +301,8 @@ func SignupResolver(ctx context.Context, params model.SignUpInput) (*model.AuthR
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, constants.AuthRecipeMethodBasicAuth, user)
|
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, constants.AuthRecipeMethodBasicAuth, user)
|
||||||
|
// User is also logged in with signup
|
||||||
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, constants.AuthRecipeMethodBasicAuth, user)
|
||||||
db.Provider.AddSession(ctx, &models.Session{
|
db.Provider.AddSession(ctx, &models.Session{
|
||||||
UserID: user.ID,
|
UserID: user.ID,
|
||||||
UserAgent: utils.GetUserAgent(gc.Request),
|
UserAgent: utils.GetUserAgent(gc.Request),
|
||||||
|
|
|
@ -125,6 +125,8 @@ func VerifyEmailResolver(ctx context.Context, params model.VerifyEmailInput) (*m
|
||||||
go func() {
|
go func() {
|
||||||
if isSignUp {
|
if isSignUp {
|
||||||
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, loginMethod, user)
|
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, loginMethod, user)
|
||||||
|
// User is also logged in with signup
|
||||||
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, loginMethod, user)
|
||||||
} else {
|
} else {
|
||||||
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, loginMethod, user)
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, loginMethod, user)
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,6 +112,8 @@ func VerifyOtpResolver(ctx context.Context, params model.VerifyOTPRequest) (*mod
|
||||||
db.Provider.DeleteOTP(gc, otp)
|
db.Provider.DeleteOTP(gc, otp)
|
||||||
if isSignUp {
|
if isSignUp {
|
||||||
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, loginMethod, user)
|
utils.RegisterEvent(ctx, constants.UserSignUpWebhookEvent, loginMethod, user)
|
||||||
|
// User is also logged in with signup
|
||||||
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, loginMethod, user)
|
||||||
} else {
|
} else {
|
||||||
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, loginMethod, user)
|
utils.RegisterEvent(ctx, constants.UserLoginWebhookEvent, loginMethod, user)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user