public void RunStepGroup() { Guid?longOperationKey = null; if (this._longOperationKey != null) { longOperationKey = (Guid)this._longOperationKey; } if (_singleThread == false) { using (var ls = new PXLoginScope(CurrentStepGroup.MainContext.UserNameForLoginScope)) { PXSessionContextFactory.AuthenticateRequest(); PXLogin.SetBranchID(CurrentStepGroup.MainContext.BranchID); CurrentStepGroup.MainContext.SetContextValues(); ls.Keep(); } lock (CurrentStepGroup.MainContext.childLongOperations) { if (longOperationKey != null) { CurrentStepGroup.MainContext.childLongOperations.Add((Guid)longOperationKey); } } PXLongOperation.StartOperation( longOperationKey, () => { if (Thread.CurrentThread.Name == null) { Thread.CurrentThread.Name = "Child - " + longOperationKey.ToString(); } CurrentStepGroup.RunAllSteps(longOperationKey); }); } else { CurrentStepGroup.RunAllSteps(longOperationKey); } }
//----------------------------------------------------------------------------- /// <summary> /// Perform the user password changing. /// </summary> protected void ChangingPassword() { string loginText = txtUser.Text; if (txtRecoveryAnswer.Visible && !PXLogin.ValidateAnswer(PXDatabase.Companies.Length > 0 ? loginText + "@" + cmbCompany.SelectedItem.Value : loginText, txtRecoveryAnswer.Text)) { this.Master.Message = PX.Data.PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.InvalidRecoveryAnswer); } if (txtNewPassword.Text != txtConfirmPassword.Text) { this.Master.Message = PX.Data.PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.PasswordNotConfirmed); } if ((string)PXContext.Session["ChangingPassword"] == txtNewPassword.Text) { this.Master.Message = PX.Data.PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.NewPasswordMustDiffer); } if (string.IsNullOrEmpty(txtNewPassword.Text)) { this.Master.Message = PX.Data.PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.PasswordBlank); } string changingPass = (string)PXContext.Session["ChangingPassword"]; if (!String.IsNullOrEmpty(this.Master.Message)) { txtVeryDummyPass.Value = changingPass; DisablingUserPassword(); EnablingChangingPassword(); return; } string gk = Request.QueryString.Get("gk"); if (gk == null && changingPass == null) { return; } string userName = PXDatabase.Companies.Length > 0 ? loginText + "@" + (cmbCompany.SelectedIndex != -1 ? cmbCompany.SelectedItem.Value : PXDatabase.Companies[0]) : loginText; try { PXLogin.LoginUser( ref userName, gk ?? changingPass, txtNewPassword.Text); } catch { txtVeryDummyPass.Value = changingPass; DisablingUserPassword(); EnablingChangingPassword(); throw; } bool isMultiFactorEnabled; string[] multifactorProviders; bool isPasswordChanging; var users = _multifactorService.GetUserIdsWithTwoFactorType(userName, txtNewPassword.Text, out isMultiFactorEnabled, out multifactorProviders, out isPasswordChanging); if (isMultiFactorEnabled) { PXLogin.LogoutUser(loginText, Session.SessionID); PXSessionContextFactory.Abandon(); if (Request.QueryString["gk"] != null) { Page.Response.Redirect("~"); } else { Page.Response.Redirect("~", true); } return; } PXLogin.InitUserEnvironment(userName, cmbLang.SelectedValue); AgreeToEula(loginText); }