Amazon web services aws cognito密码重置不起作用

Amazon web services aws cognito密码重置不起作用,amazon-web-services,cognito,Amazon Web Services,Cognito,我是aws cognito服务的新手。这是我的代码片段。它不适用于重置密码过程 请检查以下代码,并将代码更改回复给我 var EmailId = document.getElementById('email').value; //var Password = document.getElementById('txtPassword').value $.ajax({ url: EndPointURL + '/userappro

我是aws cognito服务的新手。这是我的代码片段。它不适用于重置密码过程

请检查以下代码,并将代码更改回复给我

        var EmailId = document.getElementById('email').value;
        //var Password = document.getElementById('txtPassword').value
        $.ajax({
            url: EndPointURL + '/userapproval',
            type: 'GET',
            data: JSON.stringify(EmailId),
            contentType: 'application/json; charset=utf-8',
            async: false,
            success: function (response) {
                var data = JSON.parse(response);
                //alert(data);
                var len = data.length;
                //alert('len : ' + len);
                for (var i = 0; i < len; i++) {
                    if (EmailId === data[i].EmailId) {
                        var status = data[i].status;

                        if (status.toLowerCase() !== "rejected") {
                            // When using loose Javascript files:
                            var CognitoUserPool = AmazonCognitoIdentity.CognitoUserPool;

                            var authenticationData = {
                                Username: EmailId
                                //Password: Password,
                            };
                            var authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
                            var poolData = {
                                UserPoolId: poolId, // Your user pool id here
                                ClientId: clientId // Your client id here
                            };
                            var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
                            var userData = {
                                Username: EmailId,
                                Pool: userPool
                            };

“它不工作”到底是什么意思?密码不可更新,问题出在哪里?API调用是否正常运行?然后我将使用新密码登录。登录过程不能使用新密码
                            var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);

                            cognitoUser.forgotPassword({                                    
                                onSuccess: function (result) {
                                    // console.log('call result: ' + result);
                                },
                                onFailure: function (err) {
                                    //alert(err);
                                    $("#lbl_alert").html(err);
                                    $("#myAlertModal").modal('show');
                                },
                                //Optional automatic callback
                                inputVerificationCode: function (data) {
                                    //console.log('Code sent to: ' + data);
                                    var verificationCode = prompt('Please input verification code ', '');
                                    if (verificationCode == null) {
                                        return false; //break out of the function early
                                    }
                                    if (verificationCode === '')
                                        return false;
                                    var newPassword = prompt('Enter new password ', '');
                                    if (newPassword == null) {
                                        return false; //break out of the function early
                                    }
                                    cognitoUser.confirmPassword(verificationCode, newPassword, this);                                       
                                    //alert("Password reset successfully.");
                                    $("#lbl_alert").html("Password reset successfully.");
                                    $("#myAlertModal").modal('show');
                                    document.location = 'Login.html';
                                }
                            });