【发布时间】:2022-08-13 03:10:30
【问题描述】:
import { Auth } from \'aws-amplify\';
// Send confirmation code to user\'s email or phone
Auth.forgotPassword(username)
.then(data => console.log(data))
.catch(err => console.log(err));
// Collect confirmation code and new password, then
Auth.forgotPasswordSubmit(username, code, new_password)
.then(data => console.log(data))
.catch(err => console.log(err));
我想在用户的电话号码或电子邮件未验证时捕捉到,因此我可以重新发送验证码或让用户知道。
我想我在文档中的某处看到如果电话/电子邮件未经过验证,放大应该引发错误,但事实并非如此。它将返回它已将代码发送到用户提供的电话/电子邮件,但他们永远不会收到此代码(我假设它未经过验证)。
他们实际上从未收到来自.forgotPassword 的代码,而从我这边(或在代码中),data 的响应看起来就像是代码已发送。但是.forgotPasswordSubmit 没有代码就无法工作。
如果用户的电话/电子邮件没有经过验证,我如何捕捉到他们是否真的收到了代码?
标签: reactjs amazon-web-services promise amazon-cognito