fix webhook for deactiavtion

This commit is contained in:
Lakhan Samani 2023-10-11 00:20:15 +05:30
parent 843bc022fe
commit 60de61a74e
3 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ func DeactivateAccountResolver(ctx context.Context) (*model.Response, error) {
} }
go func() { go func() {
memorystore.Provider.DeleteAllUserSessions(user.ID) memorystore.Provider.DeleteAllUserSessions(user.ID)
utils.RegisterEvent(ctx, constants.UserAccessRevokedWebhookEvent, "", user) utils.RegisterEvent(ctx, constants.UserDeactivatedWebhookEvent, "", user)
}() }()
res = &model.Response{ res = &model.Response{
Message: `user account deactivated successfully`, Message: `user account deactivated successfully`,

View File

@ -103,7 +103,7 @@ func testSetup() TestSetup {
Email: fmt.Sprintf("%d_authorizer_tester@yopmail.com", time.Now().Unix()), Email: fmt.Sprintf("%d_authorizer_tester@yopmail.com", time.Now().Unix()),
Password: "Test@123", Password: "Test@123",
WebhookEndpoint: "https://62f93101e05644803533cf36.mockapi.io/authorizer/webhook", WebhookEndpoint: "https://62f93101e05644803533cf36.mockapi.io/authorizer/webhook",
TestWebhookEventTypes: []string{constants.UserAccessEnabledWebhookEvent, constants.UserAccessRevokedWebhookEvent, constants.UserCreatedWebhookEvent, constants.UserDeletedWebhookEvent, constants.UserLoginWebhookEvent, constants.UserSignUpWebhookEvent}, TestWebhookEventTypes: []string{constants.UserAccessEnabledWebhookEvent, constants.UserAccessRevokedWebhookEvent, constants.UserCreatedWebhookEvent, constants.UserDeletedWebhookEvent, constants.UserLoginWebhookEvent, constants.UserSignUpWebhookEvent, constants.UserDeactivatedWebhookEvent},
TestEmailTemplateEventTypes: []string{constants.VerificationTypeBasicAuthSignup, constants.VerificationTypeForgotPassword, constants.VerificationTypeMagicLinkLogin, constants.VerificationTypeUpdateEmail}, TestEmailTemplateEventTypes: []string{constants.VerificationTypeBasicAuthSignup, constants.VerificationTypeForgotPassword, constants.VerificationTypeMagicLinkLogin, constants.VerificationTypeUpdateEmail},
} }

View File

@ -4,7 +4,7 @@ import "github.com/authorizerdev/authorizer/server/constants"
// IsValidWebhookEventName to validate webhook event name // IsValidWebhookEventName to validate webhook event name
func IsValidWebhookEventName(eventName string) bool { func IsValidWebhookEventName(eventName string) bool {
if eventName != constants.UserCreatedWebhookEvent && eventName != constants.UserLoginWebhookEvent && eventName != constants.UserSignUpWebhookEvent && eventName != constants.UserDeletedWebhookEvent && eventName != constants.UserAccessEnabledWebhookEvent && eventName != constants.UserAccessRevokedWebhookEvent { if eventName != constants.UserCreatedWebhookEvent && eventName != constants.UserLoginWebhookEvent && eventName != constants.UserSignUpWebhookEvent && eventName != constants.UserDeletedWebhookEvent && eventName != constants.UserAccessEnabledWebhookEvent && eventName != constants.UserAccessRevokedWebhookEvent && eventName != constants.UserDeactivatedWebhookEvent {
return false return false
} }