/// <summary>
 /// Initiate the reset password by sending a verification via email/sms
 /// </summary>
 /// <param name="userName"></param>
 /// <returns></returns>
 public async Task InitiateResetPasswordAsync(string userName)
 {
     AdminResetUserPasswordRequest adminResetUserPasswordRequest = new AdminResetUserPasswordRequest()
     {
         Username   = userName,
         UserPoolId = _appConfigInfo.AWSPoolId
     };
     await _provider.AdminResetUserPasswordAsync(adminResetUserPasswordRequest);
 }
Ejemplo n.º 2
0
        public async Task AdminResetUserPassword(Guid key)
        {
            var request = new AdminResetUserPasswordRequest
            {
                Username   = $"{key}",
                UserPoolId = _cognito.UserPool.Id
            };

            await _provider.AdminResetUserPasswordAsync(request);
        }
        /// <summary>
        /// Resets the <paramref name="user"/>'s password and sends the confirmation token to the user
        /// via email or sms depending on the user pool policy.
        /// </summary>
        /// <param name="user">The user to reset the password for.</param>
        /// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
        /// of the operation.
        public virtual async Task <IdentityResult> ResetPasswordAsync(TUser user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            var request = new AdminResetUserPasswordRequest
            {
                Username   = user.Username,
                UserPoolId = _pool.PoolID
            };

            try
            {
                await _cognitoClient.AdminResetUserPasswordAsync(request, cancellationToken).ConfigureAwait(false);

                return(IdentityResult.Success);
            }
            catch (AmazonCognitoIdentityProviderException e)
            {
                return(IdentityResult.Failed(_errorDescribers.CognitoServiceError("Failed to reset the Cognito User password", e)));
            }
        }
 public void AdminResetUserPasswordAsync(AdminResetUserPasswordRequest request, AmazonServiceCallback <AdminResetUserPasswordRequest, AdminResetUserPasswordResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }