如何通过 CloudFormation 在 Cognito 中要求电子邮件验证?

How to require email validation in Cognito through CloudFormation?

我想我尝试了这里的所有属性:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-userpool.html

无法选中此框:

我目前的配置:

    CognitoUserPoolGeneral:
      Type: AWS::Cognito::UserPool
      Properties:
        UserPoolName: general
        Policies:
          PasswordPolicy:
            MinimumLength: 6
            RequireLowercase: false
            RequireNumbers: false
            RequireSymbols: false
            RequireUppercase: false
        Schema:
          - AttributeDataType: String
            Name: preferredLocale
            DeveloperOnlyAttribute: false
            Mutable: true
            Required: false
        EmailVerificationMessage: "Here's your verification code: {####}. Please provide it inside the application."
        EmailVerificationSubject: "subject"

您可以添加

  AutoVerifiedAttributes:
    - email

到你的 Properties 键,像这样:

  UserPool:
    Type: "AWS::Cognito::UserPool"
    Properties:
      UserPoolName: !Sub ${AuthName}-user-pool
      AutoVerifiedAttributes:
        - email
      Policies:.....

有关创建 Cognito 资源的 CloudFormation 模板的优秀示例,请参阅:

https://gist.github.com/singledigit/2c4d7232fa96d9e98a3de89cf6ebe7a5