
# User Password management using the ASP.NET Core Identity Provider for Amazon Cognito
## Change a CognitoUser password
The CognitoUserManager class exposes the following method to change a CognitoUser user password:
```csharp
///
/// Changes a user's password after confirming the specified is correct,
/// as an asynchronous operation.
///
/// The user whose password should be set.
/// The current password to validate before changing.
/// The new password to set for the specified .
///
/// The that represents the asynchronous operation, containing the
/// of the operation.
///
Task ChangePasswordAsync(TUser user, string currentPassword, string newPassword);
```
You can find examples on how to change a user password in the [sample web application.](https://github.com/aws/aws-aspnet-cognito-identity-provider/blob/master/samples/Samples/Areas/Identity/Pages/Account/ChangePassword.cshtml.cs#L75)
## Check if a CognitoUser password needs to be changed
The CognitoUserManager class exposes the following method to check if a user password needs to be changed:
```csharp
///
/// Checks if the password needs to be changed for the specified .
///
/// The user to check if the password needs to be changed.
/// The that represents the asynchronous operation, containing a boolean set to true if the password needs to be changed, false otherwise.
Task IsPasswordChangeRequiredAsync(TUser user);
```
## Check if a CognitoUser password needs to be reset
The CognitoUserManager class exposes the following method to check if a user password needs to be reset:
```csharp
///
/// Checks if the password needs to be reset for the specified .
///
/// The user to check if the password needs to be reset.
/// The that represents the asynchronous operation, containing a boolean set to true if the password needs to be reset, false otherwise.
Task IsPasswordResetRequiredAsync(TUser user);
```
## Send a confirmation token to a CognitoUser to reset its password
The CognitoUserManager class exposes the following methods to send a confirmation token to a CognitoUser to reset its password:
```csharp
///
/// Resets the 's password and sends the confirmation token to the user
/// via email or sms depending on the user pool policy.
///
/// The user whose password should be reset.
///
/// The that represents the asynchronous operation, containing the
/// of the operation.
///
Task ResetPasswordAsync(TUser user);
```
## Reset a CognitoUser password using the confirmation token received by sms or email
The CognitoUserManager class exposes the following methods to reset a CognitoUser password using the confirmation token received by sms or email:
```csharp
///
/// Resets the 's password to the specified after
/// validating the given password reset .
///
/// The user whose password should be reset.
/// The password reset token to verify.
/// The new password to set if reset token verification succeeds.
///
/// The that represents the asynchronous operation, containing the
/// of the operation.
///
Task ResetPasswordAsync(TUser user, string token, string newPassword);
```