Ejemplo n.º 1
0
        protected void btnEsqueceuSenha_Click(object sender, EventArgs e)
        {
            try
            {
                // Setar o foco no txt de login, se no combo já estiver selecionado um valor (quando só
                // tem um valor no combo, seleciona automaticamente).
                if (UCComboEntidade2.Valor != Guid.Empty)
                {
                    txtEmail.Focus();

                    // Caso exista apenas uma entidade o Combo é escondido
                    UCComboEntidade2.Visible = false;
                }
                else
                {
                    UCComboEntidade2.Focus();
                }

                txtEmail.Text = string.Empty;
                lblMessageEsqueciSenha.Visible = false;
                updEsqueciSenha.Update();
                ApplicationWEB._GravaLogSistema(LOG_SistemaTipo.Login, "Usuário solicitou uma nova senha.");
                ScriptManager.RegisterClientScriptBlock(this, GetType(), "EsqueciSenhaAbrir", "$('#divEsqueciSenha').dialog('open'); ", true);
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
                lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);
            }
        }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptManager sm = ScriptManager.GetCurrent(this);

        if (sm != null)
        {
            sm.Scripts.Add(new ScriptReference(ArquivoJS.CamposData));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JqueryMask));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.MascarasCampos));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.JQueryValidation));
            sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsLogin.js"));

            if (__SessionWEB.TemaPadraoLogado.tep_tipoLogin == (byte)CFG_TemaPadrao.eTipoLogin.SobrescreveLabel)
            {
                sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsLoginRio.js"));
            }

            if (__SessionWEB.TemaPadraoLogado.tep_tipoLogin == (byte)CFG_TemaPadrao.eTipoLogin.CorrigeLayout)
            {
                sm.Scripts.Add(new ScriptReference(ArquivoJS.PastaScriptRaiz + "Telas/jsLoginIntranetSme.js"));
            }
        }

        fdsMensagem.Visible = false;
        fdsLogin.Attributes.Remove("style");

        if (!IsPostBack)
        {
            try
            {
                if (!String.IsNullOrEmpty((SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN))))
                {
                    spnMensagemUsuario.InnerHtml = HttpUtility.HtmlDecode(SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN));
                    fdsMensagem.Visible          = true;
                    fdsLogin.Attributes["style"] = "display:none;";
                    btnFechar.OnClientClick      = "$('.fdsMensagem').hide();" +
                                                   "$('#" + fdsLogin.ClientID + "').show();" +
                                                   "$('#login').find('select,input').first().focus();" +
                                                   "return false;";
                    btnFechar.Focus();
                }
                else
                {
                    Page.Form.DefaultButton = _btnEntrar.UniqueID;
                    fdsMensagem.Visible     = false;
                }

                UCComboEntidade1.Inicialize("Entidade *");
                UCComboEntidade1._EnableValidator = true;
                UCComboEntidade1._ValidationGroup = "Login";
                UCComboEntidade1._LoadBy_SistemaEntidade(Guid.Empty, 1);

                UCComboEntidade2.Inicialize("Entidade *");
                UCComboEntidade2._EnableValidator = true;
                UCComboEntidade2._ValidationGroup = "EsqueciSenha";
                UCComboEntidade2._LoadBy_SistemaEntidade(Guid.Empty, 1);

                if (UserIsAuthenticated())
                {
                    RedirecionarLogin(__SessionWEB.__UsuarioWEB.Usuario.usu_id);
                }
            }
            catch (Exception ex)
            {
                _lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);

                ApplicationWEB._GravaErro(ex);
            }
        }

        UtilBO.RegistraGATC(this.Page);
    }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager sm = ScriptManager.GetCurrent(this);

            if (sm != null)
            {
                sm.Scripts.Add(new ScriptReference("~/includes/jsLogin.js"));
            }

            // Limpa a mensagem caso seja postback.
            fdsMensagem.Visible = false;
            fdsLogin.Attributes.Remove("style");

            if (!IsPostBack)
            {
                try
                {
                    // Setar a mensagem na frente do login.
                    if (!String.IsNullOrEmpty((SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN))))
                    {
                        spnMensagemUsuario.InnerHtml = HttpUtility.HtmlDecode(SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.MENSAGEM_ALERTA_PRELOGIN));
                        fdsMensagem.Visible          = true;
                        fdsLogin.Attributes["style"] = "display:none;";
                        btnFechar.OnClientClick      = "$('.fdsMensagem').hide();" +
                                                       "$('#" + fdsLogin.ClientID + "').show();" +
                                                       "$('#login').find('select,input').first().focus();" +
                                                       "return false;";
                        btnFechar.Focus();
                    }
                    else
                    {
                        Page.Form.DefaultButton = btnEntrar.UniqueID;
                        fdsMensagem.Visible     = false;
                    }

                    UCComboEntidade1.ValidationGroup = "Login";
                    UCComboEntidade1.Obrigatorio     = true;
                    UCComboEntidade1.CarregarPorEntidadeSituacao(Guid.Empty, 1);
                    UCComboEntidade1.Visible = UCComboEntidade1.MostrarCombo;

                    UCComboEntidade2.ValidationGroup = "EsqueciSenha";
                    UCComboEntidade2.Obrigatorio     = true;
                    UCComboEntidade2.CarregarPorEntidadeSituacao(Guid.Empty, 1);
                    UCComboEntidade2.Visible = UCComboEntidade2.MostrarCombo;

                    VerificaAcessoInfantil();

                    // Verifica se usuário está autenticado, caso esteja redireciona para o sistema
                    if (UserIsAuthenticated())
                    {
                        RedirecionarLogin(false);
                    }
                }
                catch (Exception ex)
                {
                    lblMessage.Text = UtilBO.GetErroMessage("Erro ao tentar carregar o sistema.", UtilBO.TipoMensagem.Erro);

                    ApplicationWEB._GravaErro(ex);
                }

                // Configuração utilizando o parâmetro "Expressão regular para validar o tamanho da senha do usuário"
                revSenhaTamanho.ValidationExpression = SYS_ParametroBO.ParametroValor(SYS_ParametroBO.eChave.TAMANHO_SENHA_USUARIO);
                revSenhaTamanho.ErrorMessage         = String.Format(revSenhaTamanho.ErrorMessage, UtilBO.GetMessageTamanhoByRegex(revSenhaTamanho.ValidationExpression));
            }

            // Registra o GATC para a página de Login.
            UtilBO.RegistraGATC(this.Page);
        }