Пример #1
0
    private void Login()
    {
        string user = txtUserName.Text.Trim();
        string pass = txtPassword.Text.Trim();

        try
        {
            Emp em = new Emp(user);
            if (em.CheckPass(pass))
            {
                WebUser.SignInOfGenerLang(em, WebUser.SysLang);

                if (this.Request.RawUrl.ToLower().Contains("wap"))
                {
                    WebUser.IsWap = true;
                }
                else
                {
                    WebUser.IsWap = false;
                }

                WebUser.Token = this.Session.SessionID;

                Response.Redirect("Default.aspx", false);
                return;
            }
            this.Alert("用户名密码错误,注意密码区分大小写,请检查是否按下了CapsLock.。");
        }
        catch (System.Exception ex)
        {
            this.Alert("@用户名密码错误!@检查是否按下了CapsLock.@更详细的信息:" + ex.Message);
        }
    }
Пример #2
0
    //登录方法
    private void Login()
    {
        string user = TB_No.Text.Trim();
        string pass = TB_Pass.Text.Trim();

        //判断是否是记住密码
        if (hidIsRememberedPass.Value == "1")
        {
            pass = Emp.DecryptPass(pass);
        }

        try
        {
            if (WebUser.No != null)
            {
                WebUser.Exit();
            }

            if (user.ToLower() == "guest")
            {
                this.Alert("guest 用户不能登录内部用户的处理程序. ");
                return;
            }

            Emp em = new Emp();
            em.No = user;
            if (em.RetrieveFromDBSources() == 0)
            {
                this.Alert("用户名密码错误,注意密码区分大小写,请检查是否按下了CapsLock.。");
                return;
            }

            if (em.CheckPass(pass))
            {
                //bool bl = this.IsRemember.Checked;

                //WebUser.SignInOfGenerLang(em, WebUser.SysLang, bl);
                //if (this.Request.RawUrl.ToLower().Contains("wap"))
                //    WebUser.IsWap = true;
                //else
                //    WebUser.IsWap = false;
                //WebUser.Token = this.Session.SessionID;

                //调用登录接口,让BP框架登录.
                BP.WF.Dev2Interface.Port_Login(em.No, this.IsRemember.Checked);

                Response.Redirect("Default.aspx", false);
                return;
            }
            this.Alert("用户名密码错误,注意密码区分大小写,请检查是否按下了CapsLock.。");
        }
        catch (System.Exception ex)
        {
            this.Alert("@用户名密码错误!@检查是否按下了CapsLock.@更详细的信息:" + ex.Message);
        }
    }
Пример #3
0
        /// <summary>
        /// 登录.
        /// </summary>
        /// <returns></returns>
        public string Login_Submit()
        {
            string userNo = this.GetRequestVal("TB_No");

            if (userNo == null)
            {
                userNo = this.GetRequestVal("TB_UserNo");
            }

            string pass = this.GetRequestVal("TB_PW");

            if (pass == null)
            {
                pass = this.GetRequestVal("TB_Pass");
            }

            BP.Port.Emp emp = new Emp();
            emp.No = userNo;
            if (emp.RetrieveFromDBSources() == 0)
            {
                if (DBAccess.IsExitsTableCol("Port_Emp", "NikeName") == true)
                {
                    /*如果包含昵称列,就检查昵称是否存在.*/
                    Paras ps = new Paras();
                    ps.SQL = "SELECT No FROM Port_Emp WHERE NikeName=" + SystemConfig.AppCenterDBVarStr + "NikeName";
                    ps.Add("NikeName", userNo);
                    string no = DBAccess.RunSQLReturnStringIsNull(ps, null);
                    if (no == null)
                    {
                        return("err@用户名或者密码错误.");
                    }

                    emp.No = no;
                    int i = emp.RetrieveFromDBSources();
                    if (i == 0)
                    {
                        return("err@用户名或者密码错误.");
                    }
                }
                else
                {
                    return("err@用户名或者密码错误.");
                }
            }

            if (emp.CheckPass(pass) == false)
            {
                return("err@用户名或者密码错误.");
            }

            //调用登录方法.
            BP.WF.Dev2Interface.Port_Login(emp.No, emp.Name, emp.FK_Dept, emp.FK_DeptText);

            return("登录成功.");
        }
Пример #4
0
    private void Login()
    {
        string user = TB_No.Text.Trim();
        string pass = TB_Pass.Text.Trim();

        try
        {
            //关闭已登录用户
            if (WebUser.No != null)
            {
                WebUser.Exit();
            }

            Emp em = new Emp();
            em.No = user;
            if (em.RetrieveFromDBSources() == 0)
            {
                //  this.TB_No.Text = "";
                return;
            }


            if (em.CheckPass(pass))
            {
                bool bl = this.IsRemember.Checked;
                WebUser.SignInOfGenerLang(em, WebUser.SysLang, bl);

                if (this.Request.RawUrl.ToLower().Contains("wap"))
                {
                    WebUser.IsWap = true;
                }
                else
                {
                    WebUser.IsWap = false;
                }

                WebUser.Token = this.Session.SessionID;

                Response.Redirect("Default.aspx", false);
                return;
            }
            this.Alert("用户名密码错误,注意密码区分大小写,请检查是否按下了CapsLock.。");
        }
        catch (System.Exception ex)
        {
            this.Alert("@用户名密码错误!@检查是否按下了CapsLock.@更详细的信息:" + ex.Message);
        }
    }
        void btn_Click(object sender, EventArgs e)
        {
            string user = this.Pub1.GetTextBoxByID("TB_User").Text.Trim();
            string pass = this.Pub1.GetTextBoxByID("TB_Pass").Text;

            try
            {
                Emp em = new Emp();
                em.No = user;
                if (em.RetrieveFromDBSources() == 0)
                {
                    this.Alert("用户名或密码错误,注意两者区分大小写,请检查是否按下了CapsLock。");
                    return;
                }
                if (em.CheckPass(pass))
                {
                    // 执行登陆.
                    WebUser.SignInOfGenerLang(em, this.Lang);
                    if (this.Request.RawUrl.ToLower().Contains("wap"))
                    {
                        WebUser.IsWap = true;
                    }
                    else
                    {
                        WebUser.IsWap = false;
                    }

                    WebUser.Token = this.Session.SessionID;
                    string script = "<script language=JavaScript>window.control.returnLogin(" + user + ");</script>";
                    if (WebUser.IsWap)
                    {
                        System.Web.HttpContext.Current.Response.Write(script);
                        Response.Redirect("Home.aspx", true);
                        return;
                    }

                    System.Web.HttpContext.Current.Response.Write(script);
                    Response.Redirect(this.ToWhere, false);
                    return;
                }
                this.Alert("用户名或密码错误,注意两者区分大小写,请检查是否按下了CapsLock。");
            }
            catch (System.Exception ex)
            {
                this.Response.Write("<font color=red ><b>@用户名密码错误!@检查是否按下了CapsLock.@更详细的信息:" + ex.Message + "</b></font>");
            }
        }
Пример #6
0
        /// <summary>
        /// 修改密码 .
        /// </summary>
        /// <returns></returns>
        public string ChangePassword_Submit()
        {
            string oldPass = this.GetRequestVal("OldPass");
            string pass    = this.GetRequestVal("Pass");

            BP.Port.Emp emp = new Emp(BP.Web.WebUser.No);
            if (emp.CheckPass(oldPass) == false)
            {
                return("err@旧密码错误.");
            }

            if (BP.Sys.SystemConfig.IsEnablePasswordEncryption == true)
            {
                pass = BP.Tools.Cryptography.EncryptString(pass);
            }
            emp.Pass = pass;
            emp.Update();

            return("密码修改成功...");
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string strNo      = "";
        string strPs      = "";
        string isRemember = "";

        if (this.Request.QueryString["DoType"] == "Logout")
        {
            BP.Web.WebUser.Exit();
        }

        if (IsPostBack == false)
        {
            if (Request.QueryString["username"] != null)//判断是否是从其他页面跳转
            {
                strNo = Request.QueryString["username"].ToString();

                if (Request.QueryString["password"] != null)
                {
                    strPs = Request.QueryString["password"].ToString();
                    Login(strNo, strPs);
                }
            }
            else
            {
                if (this.Request.Browser.Cookies == true) //获取cookie
                {
                    if (Request.Cookies["CCS"] != null)
                    {
                        strNo = Convert.ToString(Request.Cookies["CCS"].Values["No"]);
                        if (strNo != "")
                        {
                            strPs      = Convert.ToString(Request.Cookies["CCS"].Values["Pass"]);
                            isRemember = Request.Cookies["CCS"].Values["IsRememberMe"].ToString();
                            //获取cookie中的用户名和密码,并判断是否一致
                            Emp em = new Emp(strNo);
                            em.No = strNo;
                            if (em.RetrieveFromDBSources() == 0)
                            {
                                return;
                            }

                            if (em.CheckPass(strPs))
                            {
                                WebUser.SignInOfGenerLang(em, WebUser.SysLang, isRemember == "0" ? false : true);
                                if (isRemember == "1")
                                {
                                    if (this.Request.RawUrl.ToLower().Contains("wap"))
                                    {
                                        WebUser.IsWap = true;
                                    }
                                    else
                                    {
                                        WebUser.IsWap = false;
                                    }

                                    WebUser.Token = this.Session.SessionID;

                                    Response.Redirect("Default.aspx", false);
                                    return;
                                }
                                else
                                {
                                    this.TB_No.Text = strNo;
                                }
                            }
                            else
                            {
                                this.TB_No.Text = strNo;
                            }
                        }
                    }
                }
            }
            this.Page.RegisterStartupScript("event_handler", "<script>document.body.onkeypress = keyPressed;</script>");
            this.Page.RegisterClientScriptBlock("default_button", "<script> function keyPressed() { if(window.event.keyCode == 13) { document.getElementById(\""
                                                + this.Btn1.ClientID + "\").click(); } } </script>");
            if (WebUser.No != null)
            {
                TB_No.Text = WebUser.No;
            }
        }
    }