feat(auth): 登录注册 - 添加短信通知与组合验证支持
This commit is contained in:
@@ -243,6 +243,13 @@ func loadDeclarativeManifestProvider(manifest Manifest, index int) (Adapter, err
|
||||
}
|
||||
|
||||
func ValidateManifest(manifest Manifest) error {
|
||||
seenSMS := map[string]bool{}
|
||||
for _, provider := range manifest.Contributes.SMSProviders {
|
||||
if !validManifestIdentifier(provider.ID) || strings.TrimSpace(provider.Label) == "" || seenSMS[provider.ID] {
|
||||
return fmt.Errorf("invalid or duplicate SMS provider contribution")
|
||||
}
|
||||
seenSMS[provider.ID] = true
|
||||
}
|
||||
if version := strings.TrimSpace(manifest.APIVersion); version != "yingce.plugin/v1" && version != "yingce.plugin/v2" {
|
||||
return fmt.Errorf("unsupported protocol manifest apiVersion %q", manifest.APIVersion)
|
||||
}
|
||||
@@ -402,6 +409,9 @@ func normalizeManifestForProvider(manifest *Manifest, index int) error {
|
||||
}
|
||||
|
||||
func hasNonProviderContribution(contributes ManifestContributions) bool {
|
||||
if len(contributes.SMSProviders) > 0 {
|
||||
return true
|
||||
}
|
||||
return len(contributes.PaymentProviders) > 0 || len(contributes.Workflows) > 0 || len(contributes.CanvasNodes) > 0 || len(contributes.Transforms) > 0 || len(contributes.Commands) > 0 || len(contributes.AssetSources) > 0 || len(contributes.UsageObservers) > 0 || len(contributes.AICapabilities) > 0 || len(contributes.Agents) > 0 || len(contributes.ImportExport) > 0
|
||||
}
|
||||
|
||||
|
||||
@@ -287,6 +287,7 @@ type ManifestField struct {
|
||||
}
|
||||
|
||||
type ManifestContributions struct {
|
||||
SMSProviders []ManifestSMSProvider `json:"smsProviders,omitempty"`
|
||||
Providers []ManifestProvider `json:"providers,omitempty"`
|
||||
PaymentProviders []ManifestPaymentProvider `json:"paymentProviders,omitempty"`
|
||||
Workflows []ManifestWorkflow `json:"workflows,omitempty"`
|
||||
@@ -300,6 +301,11 @@ type ManifestContributions struct {
|
||||
ImportExport []string `json:"importExport,omitempty"`
|
||||
}
|
||||
|
||||
type ManifestSMSProvider struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
type ManifestPaymentProvider struct {
|
||||
ID string `json:"id"`
|
||||
Label string `json:"label"`
|
||||
|
||||
Reference in New Issue
Block a user