Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Response.AppendHeader("Refresh", "10");

        this.lblMessage.Text                = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.SiteUnderMaintenanceCannotAccess);
        this.lblPersentCaption.Text         = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.PersentCaption) + " ";
        this.lblActionCaption.Text          = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.ActionCaption) + " ";
        this.lblAction.Text                 = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.ActionDatabaseUpdate);
        this.lblDatabaseNameCaption.Text    = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.DatabaseNameCaption) + " ";
        this.lblDatabaseVersionCaption.Text = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.DatabaseVersionCaption) + " ";
        this.lblSiteVersionCaption.Text     = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.SiteVersionCaption) + " ";
        this.lblQuestion.Text               = PXMessages.LocalizeNoPrefix(PX.Data.Update.Messages.Question) + " ";

        if (!PX.Data.Update.PXUpdateHelper.CheckUpdateLock() && PX.Data.Maintenance.PXSiteLockout.GetStatus() != PXSiteLockout.Status.Locked)
        {
            this.lblMessage.Text = PX.Data.PXMessages.Localize(PX.Data.InfoMessages.SiteMaintetanceComplite);
            PX.Data.Redirector.RedirectPage(this.Context, PXUrl.MainPagePath);
        }

        if (PXSiteLockout.GetStatus() == PXSiteLockout.Status.Locked)
        {
            this.lblMessage.Text += "<br/>" + string.Format(
                PXMessages.Localize(PX.Data.Update.Messages.LockoutReason), PXSiteLockout.Message);
        }

        PXUpdateStatusResult result = PXUpdateHelper.GetUpdateStatus();

        if ((result.ProcessStatus == PX.Data.PXLongRunStatus.InProcess))
        {
            if (result.UpdateStatus != null)
            {
                this.statusTable.Visible = true;
                this.lblPersent.Text     = result.UpdateStatus.Peresent.ToString() + "%";
                this.lblAction.Text      = PXMessages.LocalizeNoPrefix(result.UpdateStatus.Message);
            }
            if (result.UpdateQuetion != null)
            {
                this.questionTable.Visible   = true;
                this.lblQuestion.Text        = result.UpdateQuetion.Question;
                this.lblDatabaseVersion.Text = result.UpdateQuetion.DatabaseVersion;
                this.lblSiteVersion.Text     = result.UpdateQuetion.AssemblyVersion;

                if (!String.IsNullOrEmpty(result.UpdateQuetion.DatabaseName))
                {
                    this.applicationTable.Visible = true;
                    this.lblDatabaseName.Text     = result.UpdateQuetion.DatabaseName;
                }
            }
        }
        else
        {
            this.statusTable.Visible      = false;
            this.questionTable.Visible    = false;
            this.applicationTable.Visible = false;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    ///
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (cmbLang.SelectedValue != null)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cmbLang.SelectedValue);
            btnLogin.Text = PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.SignIn);
            txtUser.Attributes["placeholder"]            = PXMessages.LocalizeNoPrefix(Msg.LoginPageUserName);
            txtPass.Attributes["placeholder"]            = PXMessages.LocalizeNoPrefix(Msg.LoginPagePassword);
            txtNewPassword.Attributes["placeholder"]     = PXMessages.LocalizeNoPrefix(Msg.LoginPageNewPassword);
            txtConfirmPassword.Attributes["placeholder"] = PXMessages.LocalizeNoPrefix(Msg.LoginPageConfirmPassword);
            lnkForgotPswd.Text = PXMessages.LocalizeNoPrefix(Msg.LoginPageForgotCredentials);
        }

        lbl2FactorCap.Text    = PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.TwoFactorAuth);
        lbl2FactorMethod.Text = PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.TwoFactorSelectMethod);
        rememberDevice.Text   = PXMessages.LocalizeNoPrefix(PX.AscxControlsMessages.LoginScreen.RememberDevice);


        if (PX.Data.Update.PXUpdateHelper.CheckUpdateLock())
        {
            throw new PXUnderMaintenanceException();
        }

        var lockoutStatus = PXSiteLockout.GetStatus(true);

        if (lockoutStatus == PXSiteLockout.Status.Locked)
        {
            lblUnderMaintenance.Text    = PXMessages.Localize(PX.Data.Update.Messages.SiteUnderMaintenance);
            lblUnderMaintenance.Visible = true;

            if (!string.IsNullOrWhiteSpace(PXSiteLockout.Message))
            {
                lblUnderMaintenanceReason.Text = string.Format(
                    PXMessages.Localize(PX.Data.Update.Messages.LockoutReason), PXSiteLockout.Message);
                lblUnderMaintenanceReason.Visible = true;
            }
        }

        if (lockoutStatus == PXSiteLockout.Status.Pending)
        {
            string datetime = string.Format("{0} ({1} UTC)", PXSiteLockout.DateTime, PXSiteLockout.DateTimeUtc);
            lblUnderMaintenance.Text = string.Format(
                PXMessages.Localize(PX.Data.Update.Messages.PendingLockout),

                datetime, PXSiteLockout.Message);
            lblUnderMaintenance.Visible = true;
        }

        if (GetPostBackControl(this.Page) == cmbCompany || GetPostBackControl(this.Page) == cmbLang)
        {
            txtPass.Attributes.Add("value", txtPass.Text);
        }

        if (GetPostBackControl(this.Page) == btnLogin && !String.IsNullOrEmpty(txtDummyCpny.Value))
        {
            cmbCompany.SelectedValue = txtDummyCpny.Value;
        }

        if (string.IsNullOrWhiteSpace(MultiFactorPipelineNotStarted.Value))
        {
            MultiFactorPipelineNotStarted.Value = "true";
        }

        // if user already set password then we should disabling login and password
        if (!String.IsNullOrEmpty(txtVeryDummyPass.Value))
        {
            txtPass.Text = txtVeryDummyPass.Value;
            DisablingUserPassword();
            if (!MultiCompaniesSecure)
            {
                EnablingChangingPassword();
            }
        }

        // if (SecureCompanyID) then we should hide combobox before first login.
        // and also we should shrink companies list
        if (PXDatabase.SecureCompanyID && (Membership.Provider is PXBaseMembershipProvider))
        {
            this.cmbCompany.Visible = !String.IsNullOrEmpty(txtVeryDummyPass.Value);

            if (!String.IsNullOrEmpty(txtVeryDummyPass.Value))
            {
                List <String> companyFilter = new List <String>(PXAccess.GetCompanies(txtUser.Text, txtVeryDummyPass.Value));
                for (int i = cmbCompany.Items.Count - 1; i >= 0; i--)
                {
                    ListItem item = cmbCompany.Items[i];
                    if (!companyFilter.Contains(item.Value))
                    {
                        cmbCompany.Items.RemoveAt(i);
                    }
                }
            }
        }

        // Is user trying to recover his password using link from Email?
        if (Request.QueryString.AllKeys.Length > 0 && Request.QueryString.GetValues("gk") != null)
        {
            RemindUserPassword();
        }
        try
        {
            this.SetInfoText();
        }
        catch { /*SKIP ERROS*/ }
        this.idStorage.Value = seed;
        //try silent login
        btnLoginSilent_Click(sender, e);
    }
Ejemplo n.º 3
0
    /// <summary>
    ///
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (PX.Data.Update.PXUpdateHelper.CheckUpdateLock())
        {
            throw new PXUnderMaintenanceException();
        }

        var lockoutStatus = PXSiteLockout.GetStatus(true);

        if (lockoutStatus == PXSiteLockout.Status.Locked)
        {
            lblUnderMaintenance.Text    = PXMessages.Localize(PX.Data.Update.Messages.SiteUnderMaintenance);
            lblUnderMaintenance.Visible = true;

            if (!string.IsNullOrWhiteSpace(PXSiteLockout.Message))
            {
                lblUnderMaintenanceReason.Text = string.Format(
                    PXMessages.Localize(PX.Data.Update.Messages.LockoutReason), PXSiteLockout.Message);
                lblUnderMaintenanceReason.Visible = true;
            }
        }

        if (lockoutStatus == PXSiteLockout.Status.Pending)
        {
            string datetime = string.Format("{0} ({1} UTC)", PXSiteLockout.DateTime, PXSiteLockout.DateTimeUtc);
            lblUnderMaintenance.Text = string.Format(
                PXMessages.Localize(PX.Data.Update.Messages.PendingLockout),

                datetime, PXSiteLockout.Message);
            lblUnderMaintenance.Visible = true;
        }

        if (GetPostBackControl(this.Page) == cmbCompany)
        {
            txtPass.Attributes.Add("value", txtPass.Text);
        }

        if (GetPostBackControl(this.Page) == btnLogin && !String.IsNullOrEmpty(txtDummyCpny.Value))
        {
            cmbCompany.SelectedValue = txtDummyCpny.Value;
        }

        // if user already set password then we should disabling login and password
        if (!String.IsNullOrEmpty(txtVeryDummyPass.Value))
        {
            txtPass.Text = txtVeryDummyPass.Value;
            DisablingUserPassword();
            if (!MultiCompaniesSecure)
            {
                EnablingChangingPassword();
            }
        }

        // if (SecureCompanyID) then we should hide combobox before first login.
        // and also we should shrink companies list
        if (PXDatabase.SecureCompanyID && (Membership.Provider is PXBaseMembershipProvider))
        {
            this.cmbCompany.Visible = !String.IsNullOrEmpty(txtVeryDummyPass.Value);

            if (!String.IsNullOrEmpty(txtVeryDummyPass.Value))
            {
                List <String> companyFilter = new List <String>(PXAccess.GetCompanies(txtUser.Text, txtVeryDummyPass.Value));
                for (int i = cmbCompany.Items.Count - 1; i >= 0; i--)
                {
                    ListItem item = cmbCompany.Items[i];
                    if (!companyFilter.Contains(item.Value))
                    {
                        cmbCompany.Items.RemoveAt(i);
                    }
                }
            }
        }

        // Is user trying to recover his password using link from Email?
        if (Request.QueryString.AllKeys.Length > 0 && Request.QueryString.GetValues("gk") != null)
        {
            RemindUserPassword();
        }
        try
        {
            this.SetInfoText();
        }
        catch { /*SKIP ERROS*/ }
        this.idStorage.Value = seed;
        //try silent login
        btnLoginSilent_Click(sender, e);
    }