コード例 #1
0
        public void ResetUserPassword()
        {
            try
            {
                UserSummary selectedUser = CollectionUtils.FirstElement(this.SelectedItems);
                if (selectedUser == null)
                {
                    return;
                }

                // confirm this action
                if (this.Host.ShowMessageBox(string.Format("Reset password for user {0}?", selectedUser.UserName), MessageBoxActions.OkCancel) == DialogBoxAction.Cancel)
                {
                    return;
                }

                Platform.GetService <IUserAdminService>(
                    delegate(IUserAdminService service)
                {
                    ResetUserPasswordResponse response = service.ResetUserPassword(new ResetUserPasswordRequest(selectedUser.UserName));
                    this.Table.Items.Replace(delegate(UserSummary u) { return(u.UserName == response.UserSummary.UserName); },
                                             response.UserSummary);
                });
            }
            catch (Exception e)
            {
                // failed
                ExceptionHandler.Report(e, this.Host.DesktopWindow);
            }
        }
コード例 #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ResetUserPasswordResponse response = new ResetUserPasswordResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("temporaryPassword", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.TemporaryPassword = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("userId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.UserId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #3
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ResetUserPasswordResponse response = new ResetUserPasswordResponse();


            return(response);
        }
コード例 #4
0
        //[Authorize]
        //[ApiExplorerSettings(IgnoreApi = true)]
        public ResetUserPasswordResponse ResetUserPassword(string userEmail)
        {
            ResetUserPasswordResponse retObj = new ResetUserPasswordResponse();

            string errorMsg = string.Empty;

            retObj.Status = UserDetailsFacade.ResetUserPassword(userEmail, out errorMsg);

            if (!string.IsNullOrEmpty(errorMsg))
            {
                retObj.Message = errorMsg;
            }

            return(retObj);
        }