diff --git a/pkg/notify/models/config.go b/pkg/notify/models/config.go index cbafde0242..97e62b0fc2 100644 --- a/pkg/notify/models/config.go +++ b/pkg/notify/models/config.go @@ -89,13 +89,15 @@ func (cm *SConfigManager) ValidateCreateData(ctx context.Context, userCred mccli } driver := GetDriver(input.Type) // validate - message, err := driver.ValidateConfig(ctx, api.NotifyConfig{ - SNotifyConfigContent: *input.Content, - Attribution: input.Attribution, - DomainId: input.ProjectDomainId, - }) - if err != nil { - return input, errors.Wrapf(err, message) + if input.Type != api.MOBILE { + message, err := driver.ValidateConfig(ctx, api.NotifyConfig{ + SNotifyConfigContent: *input.Content, + Attribution: input.Attribution, + DomainId: input.ProjectDomainId, + }) + if err != nil { + return input, errors.Wrapf(err, message) + } } if len(input.Name) == 0 { input.Name = input.Type @@ -166,13 +168,15 @@ func (c *SConfig) ValidateUpdateData(ctx context.Context, userCred mcclient.Toke // check if changed if input.Content != nil { driver := GetDriver(c.Type) - message, err := driver.ValidateConfig(ctx, api.NotifyConfig{ - DomainId: c.DomainId, - Attribution: c.Attribution, - SNotifyConfigContent: *input.Content, - }) - if err != nil { - return input, errors.Wrapf(err, message) + if c.Type != api.MOBILE { + message, err := driver.ValidateConfig(ctx, api.NotifyConfig{ + SNotifyConfigContent: *input.Content, + Attribution: c.Attribution, + DomainId: c.DomainId, + }) + if err != nil { + return input, errors.Wrapf(err, message) + } } } return input, nil diff --git a/pkg/notify/sender/mobile.go b/pkg/notify/sender/mobile.go index 7556ff0b75..abed79868a 100644 --- a/pkg/notify/sender/mobile.go +++ b/pkg/notify/sender/mobile.go @@ -53,7 +53,7 @@ func (smsSender *SMobileSender) ValidateConfig(ctx context.Context, config api.N if driver == nil { return "", errors.Wrap(errors.ErrNotFound, "driver disabled") } - return "", nil + return "", driver.Verify(&config) } func (smsSender *SMobileSender) UpdateConfig(config api.NotifyConfig) error {