【问题标题】:How to require email validation in Cognito through CloudFormation?如何通过 CloudFormation 在 Cognito 中要求电子邮件验证?
【发布时间】:2018-04-08 22:57:28
【问题描述】:

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

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"

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation amazon-cognito aws-cognito


    【解决方案1】:

    你可以添加

      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

    【讨论】:

    • 等等。 “AutoVerifiedAttributes”如何转换为“需要验证”??
    • @Birowsky 我同意 100%,AutoVerifiedAttributes 是一个可怕的名字。
    • 意思是这样的:自动启动邮箱验证我看的时候还以为是:邮箱不需要验证,设置为已验证自动.
    • 如果我将电子邮件和电话号码都添加到此字段,它会验证两个属性吗?还是任何一个?
    • @YashKalwani 从未尝试过,但我猜是的,因为它接受一个数组。
    猜你喜欢
    • 2019-10-07
    • 1970-01-01
    • 2018-03-02
    • 2021-11-21
    • 2010-09-23
    • 2016-10-02
    • 2020-09-30
    • 1970-01-01
    • 2018-02-16
    相关资源
    最近更新 更多