Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Start: setNewPasswordForAdmin
- setNewPasswordForAdmin(username: string, password: string) {
- //Start: Creating new user with username and pool data
- const adminUserdata = {
- Username: username,
- Pool: userpoolAdmin
- }
- const adminuser = new CognitoUser(adminUserdata);
- //End: Creating new user with username and pool data
- //create attributelist array which will contain all the attributes requried for signing in
- //these attributes are those attributes, which are selected while creating user pool on aws
- const attributeList : CognitoUserAttribute[] = [];
- //form a json object containing Name and Value of attribute used
- const usernameattribute = {
- Name:'username',
- Value: username
- }
- //Push list of attributes in the attributeList array
- attributeList.push(new CognitoUserAttribute(usernameattribute));
- console.log(attributeList);
- const that = this;
- adminuser.completeNewPasswordChallenge(password, attributeList ,{
- onFailure(err){
- console.log(err);
- },
- onSuccess(result){
- console.log(":::::::: Password change successfull ");
- that.router.navigate(['']);
- }
- });
- }
- //End: setNewPasswordForAdmin
Add Comment
Please, Sign In to add comment