什么是 "cognitoUser.getAttributeVerificationCode"?

What is "cognitoUser.getAttributeVerificationCode"?

我相信亚马逊会竭尽全力让理解他们的平台变得尽可能困难。

我在亚马逊上阅读了有关 "cognitoUser.getAttributeVerificationCode" 的文档,结果让我更加困惑!

Verify an Attribute The following example verifies user attributes for an authenticated user.

cognitoUser.getAttributeVerificationCode('email', {
    onSuccess: function (result) {
        console.log('call result: ' + result);
    },
    onFailure: function(err) {
        alert(err);
    },
    inputVerificationCode: function() {
        var verificationCode = prompt('Please input verification code: ' ,'');
        cognitoUser.verifyAttribute('email', verificationCode, this);
    }
});

任何人都可以帮助我了解这是什么 (cognitoUser.getAttributeVerificationCode) and/or 我将如何使用它?不明白为什么要验证邮箱属性w/a验证码

验证码发送到用户邮箱。用户必须正确接收该电子邮件以检索代码并将其输入 UI,以便将电子邮件设置为在 Cognito 中验证。然后该用户可以使用该电子邮件重置密码。

如果用户输入了错误的电子邮件怎么办?或者他们的电子邮件系统不允许他们接收 AWS 发送的代码?

通过发送验证码并让用户发回,Cognito 验证电子邮件是否输入正确且属于该用户。这看起来很痛苦,但现在在许多网络平台上都是标准的......需要相同的过程,你的 Cognito 用户池中的用户 phone 号码。