Trigger on pre-registration這個選項lambda函數(Node.js v6):
exports.handler = function(event, context) {
event.response.autoConfirmUser = true;
event.response.autoVerifyEmail = true;
event.response.autoVerifyPhone = true;
context.done(null, event);
};
使用「配置測試事件」,你可以先用這個有效載荷
{
"version": 1,
"triggerSource": "PreSignUp_SignUp",
"region": "<region>",
"userPoolId": "<userPoolId>",
"userName": "<userName>",
"callerContext": {
"awsSdk": "<calling aws sdk with version>",
"clientId": "<apps client id>"
},
"request": {
"userAttributes": {
"email": "[email protected]"
},
"validationData": {
"k1": "v1",
"k2": "v2"
}
},
"response": {
"autoConfirmUser": false,
"autoVerifyEmail": false,
"autoVerifyPhone": false
}
}
當你創建一個從API的驗證標誌應該是true
用戶測試它現在。
感謝您的回覆,所以我收集如果用戶丟失了密碼,我們處於CONFIRMED email_verified = false狀態,唯一能想到的是將刪除他們的帳戶並重新創建它。 – user1432403
正確。他們必須登錄才能獲取通過此流程所需的令牌。 –
有沒有計劃讓這個工作? [docs](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminCreateUser.html)表示在創建用戶時該標誌可以設置爲true,而控制檯排序認爲它已被驗證(它將顯示「重置密碼」按鈕),但實際上嘗試重置密碼失敗並顯示「未驗證的電子郵件」錯誤。對於用戶來說,通過電子郵件向他們發送一個臨時密碼似乎不僅僅是一件愚蠢的事情(而且也是一種痛苦),然後再發送*另一封電子郵件來驗證他們的電子郵件地址是否有效。 – kdgregory