Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ChangePassword(username, password, newpassword) {
- var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails({
- Username: username,
- Password: password,
- });
- var userData = {
- Username: username,
- Pool: userPool
- };
- var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
- cognitoUser.authenticateUser(authenticationDetails, {
- onSuccess: function (result) {
- cognitoUser.changePassword(password, newpassword, (err, result) => {
- if (err) {
- console.log(err);
- } else {
- console.log("Successfully changed password of the user.");
- console.log(result);
- }
- });
- },
- onFailure: function (err) {
- console.log(err);
- },
- });
- }
Add Comment
Please, Sign In to add comment