示例#1
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 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 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();
            }
        }
        /// <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());
            }
        }