/// <summary>
 /// Performs the password validation rules. If validation fails an exception is raised from the
 /// ValidateUserPassword method. If validation succeeds, but the password was changed
 /// to an empty string that result is returned, which will be displayed to the UI.
 /// </summary>
 /// <param name="form">The change password form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void btnSave_OnClick(IUserChangePassword form, EventArgs args)
 {
     string newPassword = form.txtNewPassword.Text;
     if (newPassword.Equals(form.txtConfirmPassword.Text))
     {
         IUser user = (IUser)form.usrUser.LookupResultValue;
         if (user.ValidateUserPassword(newPassword))
         {
             Sage.Platform.WebPortal.Services.IWebDialogService ds = form.Services.Get<Sage.Platform.WebPortal.Services.IWebDialogService>();
             user.SavePassword(newPassword);
             form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty;
             if(newPassword.Length == 0)
             {
                 ds.ShowMessage(form.GetResource("PasswordBlank").ToString());
             }
             else
             {
                ds.ShowMessage(form.GetResource("PasswordChanged").ToString());
             }
             ds.CloseEventHappened(form, null);
             Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get<Sage.Platform.WebPortal.Services.IPanelRefreshService>();
             if (refresher != null)
             {
                refresher.RefreshAll();
             }
         }
     }
     else
     {
         throw new Sage.Platform.Application.ValidationException(form.GetResource("Error_PasswordsDontMatch").ToString());
     }
 }
示例#2
0
        /// <summary>
        /// Performs the password validation rules. If validation fails an exception is raised from the
        /// ValidateUserPassword method. If validation succeeds, but the password was changed
        /// to an empty string that result is returned, which will be displayed to the UI.
        /// </summary>
        /// <param name="form">The change password form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void btnSave_OnClick(IUserChangePassword form, EventArgs args)
        {
            string newPassword = form.txtNewPassword.Text;

            if (newPassword.Equals(form.txtConfirmPassword.Text))
            {
                IUser user = (IUser)form.usrUser.LookupResultValue;
                if (user.ValidateUserPassword(newPassword))
                {
                    Sage.Platform.WebPortal.Services.IWebDialogService ds = form.Services.Get <Sage.Platform.WebPortal.Services.IWebDialogService>();
                    user.SavePassword(newPassword);
                    form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty;
                    if (newPassword.Length == 0)
                    {
                        ds.ShowMessage(form.GetResource("PasswordBlank").ToString());
                    }
                    else
                    {
                        ds.ShowMessage(form.GetResource("PasswordChanged").ToString());
                    }
                    ds.CloseEventHappened(form, null);
                    Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>();
                    if (refresher != null)
                    {
                        refresher.RefreshAll();
                    }
                }
            }
            else
            {
                throw new Sage.Platform.Application.ValidationException(form.GetResource("Error_PasswordsDontMatch").ToString());
            }
        }
 /// <summary>
 /// Performs the password validation rules. If validation fails an exception is raised from the
 /// ValidateUserPassword method. If validation succeeds, but the password was changed
 /// to an empty string that result is returned, which will be displayed to the UI.
 /// </summary>
 /// <param name="form">The change password form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void btnToolbarSave_OnClick(IUserChangePassword form, EventArgs args)
 {
     string newPassword = form.txtConfirmPassword.Text;
     if (newPassword.Equals(form.txtConfirmPassword.Text))
     {
         IUser user = (IUser)form.usrUser.LookupResultValue;
         if (!user.ValidateUserPassword(newPassword))
         {
             if (user.SavePassword(newPassword))
             {
                 form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty;
             }
         }
     }
     else
     {
         form.lblInvalidPassword.Text = form.GetResource("Error_PasswordsDontMatch").ToString();
     }
 }
示例#4
0
        /// <summary>
        /// Performs the password validation rules. If validation fails an exception is raised from the
        /// ValidateUserPassword method. If validation succeeds, but the password was changed
        /// to an empty string that result is returned, which will be displayed to the UI.
        /// </summary>
        /// <param name="form">The change password form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void btnSave_OnClick(IUserChangePassword form, EventArgs args)
        {
            string newPassword = form.txtNewPassword.Text;

            if (newPassword.Equals(form.txtConfirmPassword.Text))
            {
                IUser user = (IUser)form.CurrentEntity;

                if (user.ValidateUserPassword(newPassword))
                {
                    Sage.Platform.WebPortal.Services.IWebDialogService ds = form.Services.Get <Sage.Platform.WebPortal.Services.IWebDialogService>();
                    user.SavePassword(newPassword);
                    var slxUserService = (ISlxUserService)ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>(true);
                    var currentUser    = slxUserService.GetUser();
                    if (user.UserName == currentUser.UserName)
                    {
                        var data = (Sage.SalesLogix.SLXDataService)ApplicationContext.Current.Services.Get <IDataService>(true);
                        var auth = (Sage.SalesLogix.Web.SLXWebAuthenticationProvider)data.AuthenticationProvider;
                        auth.AuthenticateWithContext(currentUser.UserName, newPassword);
                    }

                    form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty;
                    if (newPassword.Length == 0)
                    {
                        ds.ShowMessage(form.GetResource("PasswordBlank").ToString());
                    }
                    else
                    {
                        ds.ShowMessage(form.GetResource("PasswordChanged").ToString());
                    }
                    ds.CloseEventHappened(form, null);
                    Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get <Sage.Platform.WebPortal.Services.IPanelRefreshService>();
                    if (refresher != null)
                    {
                        refresher.RefreshAll();
                    }
                }
            }
            else
            {
                throw new Sage.Platform.Application.ValidationException(form.GetResource("Error_PasswordsDontMatch").ToString());
            }
        }
        /// <summary>
        /// Performs the password validation rules. If validation fails an exception is raised from the
        /// ValidateUserPassword method. If validation succeeds, but the password was changed
        /// to an empty string that result is returned, which will be displayed to the UI.
        /// </summary>
        /// <param name="form">The change password form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void btnSave_OnClick(IUserChangePassword form, EventArgs args)
        {
            string newPassword = form.txtNewPassword.Text;
            if (newPassword.Equals(form.txtConfirmPassword.Text))
            {
                IUser user = (IUser)form.CurrentEntity;

                if (user.ValidateUserPassword(newPassword))
                {
                    Sage.Platform.WebPortal.Services.IWebDialogService ds = form.Services.Get<Sage.Platform.WebPortal.Services.IWebDialogService>();
                    user.SavePassword(newPassword);
                    var slxUserService = (ISlxUserService)ApplicationContext.Current.Services.Get<Sage.Platform.Security.IUserService>(true);
                    var currentUser = slxUserService.GetUser();
                    if (user.UserName == currentUser.UserName)
                    {
                        var data = (Sage.SalesLogix.SLXDataService)ApplicationContext.Current.Services.Get<IDataService>(true);
                        var auth = (Sage.SalesLogix.Web.SLXWebAuthenticationProvider)data.AuthenticationProvider;
                        auth.AuthenticateWithContext(currentUser.UserName, newPassword);
             					}

                    form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty;
                    if(newPassword.Length == 0)
                    {
                        ds.ShowMessage(form.GetResource("PasswordBlank").ToString());
                    }
                    else
                    {
                       ds.ShowMessage(form.GetResource("PasswordChanged").ToString());
                    }
                    ds.CloseEventHappened(form, null);
                    Sage.Platform.WebPortal.Services.IPanelRefreshService refresher = form.Services.Get<Sage.Platform.WebPortal.Services.IPanelRefreshService>();
                    if (refresher != null)
                    {
                       refresher.RefreshAll();
                    }
                }
            }
            else
            {
                throw new Sage.Platform.Application.ValidationException(form.GetResource("Error_PasswordsDontMatch").ToString());
            }
        }
        /// <summary>
        /// Performs the password validation rules. If validation fails an exception is raised from the
        /// ValidateUserPassword method. If validation succeeds, but the password was changed
        /// to an empty string that result is returned, which will be displayed to the UI.
        /// </summary>
        /// <param name="form">The change password form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void btnToolbarSave_OnClick(IUserChangePassword form, EventArgs args)
        {
            string newPassword = form.txtConfirmPassword.Text;

            if (newPassword == form.txtConfirmPassword.Text)
            {
                IUser user = (IUser)form.usrUser.LookupResultValue;
                if (!user.ValidateUserPassword(newPassword))
                {
                    if (user.SavePassword(newPassword))
                    {
                        form.lblInvalidPassword.Text = newPassword.Length == 0 ? form.GetResource("PasswordBlank").ToString() : String.Empty;
                    }
                }
            }
            else
            {
                form.lblInvalidPassword.Text = form.GetResource("Error_PasswordsDontMatch").ToString();
            }
        }
示例#7
0
        /// <summary>
        /// Loads the default setting for the change password form.
        /// </summary>
        /// <param name="form">The change password form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void OnChangePasswordLoad(IUserChangePassword form, EventArgs args)
        {
            IEntityHistoryService entities = ApplicationContext.Current.Services.Get <IEntityHistoryService>(false);

            if (entities != null)
            {
                EntityHistory entity = entities[0];
                if (entity != null && entity.EntityType == typeof(IUser))
                {
                    if (form.usrUser.LookupResultValue == null)
                    {
                        form.usrUser.LookupResultValue = entity.EntityId;
                    }
                    form.ctrlstButtons.Visible = true;
                }
                else
                {
                    form.ctrlstButtons.Visible = false;
                }
            }
        }
 /// <summary>
 /// Loads the default setting for the change password form.
 /// </summary>
 /// <param name="form">The change password form.</param>
 /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 public static void OnChangePasswordLoad(IUserChangePassword form, EventArgs args)
 {
     IEntityHistoryService entities = ApplicationContext.Current.Services.Get<IEntityHistoryService>(false);
     if (entities != null)
     {
         EntityHistory entity = entities[0];
         if (entity != null && entity.EntityType.Equals(typeof(IUser)))
         {
             //form.usrUser.Enabled = (entity.EntityId.ToString().Trim().Equals("ADMIN"));
             if (form.usrUser.LookupResultValue == null)
             {
                 form.usrUser.LookupResultValue = entity.EntityId;
             }
             form.ctrlstButtons.Visible = true;
         }
         else
         {
             form.ctrlstButtons.Visible = false;
             //form.usrUser.LookupResultValue = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser;
         }
     }
 }
示例#9
0
        /// <summary>
        /// Loads the default setting for the change password form.
        /// </summary>
        /// <param name="form">The change password form.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public static void OnChangePasswordLoad(IUserChangePassword form, EventArgs args)
        {
            IEntityHistoryService entities = ApplicationContext.Current.Services.Get <IEntityHistoryService>(false);

            if (entities != null)
            {
                EntityHistory entity = entities[0];
                if (entity != null && entity.EntityType.Equals(typeof(IUser)))
                {
                    //form.usrUser.Enabled = (entity.EntityId.ToString().Trim().Equals("ADMIN"));
                    if (form.usrUser.LookupResultValue == null)
                    {
                        form.usrUser.LookupResultValue = entity.EntityId;
                    }
                    form.ctrlstButtons.Visible = true;
                }
                else
                {
                    form.ctrlstButtons.Visible = false;
                    //form.usrUser.LookupResultValue = Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser;
                }
            }
        }