Esempio n. 1
0
    void ChangePassword()
    {
        //前端校验2次密码输入是否一致
        LCSS.Model.T_Account model = new LCSS.Model.T_Account();
        model.ACCT_LoginID = txtAccount.Value;
        model.ACCT_Pwd     = txtCurrent.Value;
        LCSS.BLL.T_Account T_AccountBLL = new LCSS.BLL.T_Account();
        bool isRight = T_AccountBLL.Exists(txtAccount.Value, DESEncrypt.Encrypt(txtCurrent.Value));

        if (isRight)
        {
            if (T_AccountBLL.UpdatePassword(txtAccount.Value, DESEncrypt.Encrypt(txtNew.Value.Trim())))
            {
                Response.Write("<script>alert('修改成功,请使用新密码重新登陆!');window.parent.location.href='../Login.aspx';</script>");
                //Response.Redirect("../Login.aspx");
            }
            else
            {
                Response.Write("<script>alert('密码修改失败,请联系管理员!');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('当前密码输入不正确,请重新输入!');</script>");
        }
    }
Esempio n. 2
0
 protected void btnLogin_ServerClick(object sender, EventArgs e)
 {
     LCSS.Model.T_Account oAccount = new LCSS.BLL.T_Account().GetLoginInfo(txtUserName.Value, DESEncrypt.Encrypt(txtPassword.Value.Trim()));
     if (oAccount == null)
     {
         //throw new Exception("用户名或密码错误");
         lblmsg.InnerText = "用户名或密码错误!";
         return;
     }
     LCSS.Model.LoginInfo oLoginInfo = new LCSS.Model.LoginInfo();
     oLoginInfo.Agent     = Request.UserAgent;
     oLoginInfo.HostName  = Request.UserHostName;
     oLoginInfo.IPAdr     = Request.UserHostAddress;
     oLoginInfo.LoginID   = oAccount.ACCT_LoginID;
     oLoginInfo.LoginTime = System.DateTime.Now.ToString();
     if (string.IsNullOrEmpty(oAccount.ACCT_US_Code))
     {
         oLoginInfo.OrgCode  = oAccount.ACCT_Org_Code;
         oLoginInfo.UserName = oAccount.ACCT_UserName;
     }
     else
     {
         LCSS.Model.Employees oEmployees = new LCSS.Model.Employees();
         oEmployees = new LCSS.BLL.Employees().GetModel(oAccount.ACCT_US_Code);
         if (oAccount == null)
         {
             //throw new Exception("用户名或密码错误");
             lblmsg.InnerText = "没有找到对应的员工!";
             return;
         }
         oLoginInfo.UserID   = oEmployees.Emp_Code;
         oLoginInfo.UserName = oEmployees.Emp_Name;
         oLoginInfo.OrgCode  = oEmployees.Emp_Org_Code;
     }
     oLoginInfo.OrgName = new LCSS.BLL.Organization().GetModel(oLoginInfo.OrgCode).Org_Name;
     Session[PageSessionName.LoginObject] = oLoginInfo;
     Response.Redirect("Default.aspx");
 }