Пример #1
0
        /// <summary>
        /// Create new password for newly created user.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static CompleteResetPasswordResponse ChangePassword(string userName, string password = null, string updatedPassword = null)
        {
            CompleteResetPasswordResponse response = null;

            if (userName != null)
            {
                InitiateResetPasswordRequest Request = new InitiateResetPasswordRequest();
                Request.programWebsiteId = "BBB";
                Request.username         = userName;
                InitiateResetPasswordResponse Response = target4.InitiateResetPassword(Request);

                if (Response != null)
                {
                    string token = Response.InitiateResetPasswordResult.PasswordToken;
                    if (!string.IsNullOrWhiteSpace(token))
                    {
                        CompleteResetPasswordRequest req = new CompleteResetPasswordRequest();
                        req.newPassword   = updatedPassword;
                        req.passwordToken = token;
                        response          = target4.CompleteResetPassword(req);
                    }
                }
            }
            return(response);
        }
Пример #2
0
 public static async Task InitiateResetPassword(string username, string emailSubject = null)
 {
     var request = new InitiateResetPasswordRequest
     {
         Username = username, 
         EmailSubject = emailSubject ?? "Reset your password"
     };
     var response = await request.ExecuteAsync();
     if (response.Status.IsSuccessful != true)
         throw response.Status.ToFault();
 }
Пример #3
0
        public static async Task InitiateResetPassword(string username, string emailSubject = null)
        {
            var request = new InitiateResetPasswordRequest
            {
                Username     = username,
                EmailSubject = emailSubject ?? "Reset your password"
            };
            var response = await request.ExecuteAsync();

            if (response.Status.IsSuccessful != true)
            {
                throw response.Status.ToFault();
            }
        }