示例#1
0
    //-----------------------------------------------------------------------------
    /// <summary>
    ///
    /// </summary>
    private void RemindUserPassword()
    {
        string login = "";
        string cid   = null;

        if (PXDatabase.Companies.Length > 0 && Request.QueryString.GetValues("cid") != null)
        {
            cid   = Request.QueryString.Get("cid");
            login = "******" + cid;
        }
        try
        {
            string username = PXLogin.FindUserByHash(Request.QueryString.Get("gk"), login);
            if (username != null)
            {
                _passwordRecoveryLinkExpired = false;
                txtUser.Text      = username;
                txtPass.Text      = Request.QueryString.Get("gk");
                txtUser.ReadOnly  = true;
                txtUser.BackColor = System.Drawing.Color.LightGray;

                lnkForgotPswd.Visible  = false;
                txtPass.Visible        = false;
                txtPass.TextMode       = TextBoxMode.SingleLine;
                txtDummyPass.Text      = txtPass.Text;
                txtDummyPass.Visible   = true;
                txtNewPassword.Visible = txtConfirmPassword.Visible = true;

                txtRecoveryQuestion.Text = PXLogin.FindQuestionByUsername(username, login);
                if (!string.IsNullOrEmpty(txtRecoveryQuestion.Text))
                {
                    txtRecoveryQuestion.ReadOnly  = true;
                    txtRecoveryQuestion.BackColor = System.Drawing.Color.LightGray;
                    txtRecoveryQuestion.Visible   = true;
                    txtRecoveryAnswer.Visible     = true;
                }

                //this.Master.Message = PX.Data.PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.PleaseChangePassword);
                if (cid != null)
                {
                    this.cmbCompany.SelectedValue = cid;
                    this.cmbCompany.Enabled       = false;
                    this.txtDummyCpny.Value       = this.cmbCompany.SelectedValue;
                }
            }
        }
        catch (PXPasswordRecoveryExpiredException)
        {
            _passwordRecoveryLinkExpired = true;
        }
    }