Search in sources :

Example 1 with ConfirmForgotPasswordRequest

use of com.amazonaws.services.cognitoidentityprovider.model.ConfirmForgotPasswordRequest in project aws-sdk-android by aws-amplify.

the class CognitoUser method confirmPasswordInternal.

/**
 * Internal method to set a new password.
 *
 * @param verificationCode REQUIRED: Verification code sent to the user.
 * @param newPassword REQUIRED: New password for the user.
 */
private void confirmPasswordInternal(final String verificationCode, final String newPassword, final Map<String, String> clientMetadata) {
    final ConfirmForgotPasswordRequest confirmResetPasswordRequest = new ConfirmForgotPasswordRequest();
    confirmResetPasswordRequest.setUsername(userId);
    confirmResetPasswordRequest.setClientId(clientId);
    confirmResetPasswordRequest.setSecretHash(secretHash);
    confirmResetPasswordRequest.setConfirmationCode(verificationCode);
    confirmResetPasswordRequest.setPassword(newPassword);
    confirmResetPasswordRequest.setUserContextData(getUserContextData());
    confirmResetPasswordRequest.setClientMetadata(clientMetadata);
    final String pinpointEndpointId = pool.getPinpointEndpointId();
    if (pinpointEndpointId != null) {
        AnalyticsMetadataType amd = new AnalyticsMetadataType();
        amd.setAnalyticsEndpointId(pinpointEndpointId);
        confirmResetPasswordRequest.setAnalyticsMetadata(amd);
    }
    cognitoIdentityProviderClient.confirmForgotPassword(confirmResetPasswordRequest);
}
Also used : AnalyticsMetadataType(com.amazonaws.services.cognitoidentityprovider.model.AnalyticsMetadataType) ConfirmForgotPasswordRequest(com.amazonaws.services.cognitoidentityprovider.model.ConfirmForgotPasswordRequest)

Aggregations

AnalyticsMetadataType (com.amazonaws.services.cognitoidentityprovider.model.AnalyticsMetadataType)1 ConfirmForgotPasswordRequest (com.amazonaws.services.cognitoidentityprovider.model.ConfirmForgotPasswordRequest)1