Ejemplo n.º 1
0
        public ActionResult Login(string Username, string Password, string ReturnUrl)
        {
            AjaxModel model = new AjaxModel();

            IBLL.IUserBLL bll  = BLLSessionFactory.GetBLLSession().IUserBLL;
            User          user = new User();

            Password = Encryt.GetMD5(Password.Trim());
            user     = bll.Login(Username.Trim(), Password);
            if (user == null)
            {
                model.Data  = user;
                model.Msg   = "用户名或者密码不正确!";
                model.Statu = "err";
            }
            else
            {
                FormsAuthentication.SetAuthCookie(Username.Trim(), false);
                model.Data    = user;
                model.Statu   = "ok";
                model.BackUrl = ReturnUrl == null ? "/Home/Index" : ReturnUrl;
                log.Info(new LogContent(Username + ":登陆", LogType.记录.ToString(), HttpHelper.GetIPAddress()));
            }
            return(Json(model));
        }
Ejemplo n.º 2
0
 public UserController(IBLL.IUser_Role_DeptViewBLL uviewbll, IBLL.IUserBLL ubll, IBLL.IRoleBLL rolebll, IBLL.IDepartmentBLL deptbll, IBLL.IUserRoleBLL ur_bll, IBLL.IUserDepartmentBLL udbll)
 {
     _userviewBLL = uviewbll;
     _userBLL     = ubll;
     _roleBLL     = rolebll;
     _urBLL       = ur_bll;
     _udBLL       = udbll;
     _deptBLL     = deptbll;
 }
Ejemplo n.º 3
0
        public ActionResult RegisterDetail(string Username, string Password, string Email)
        {
            AjaxModel model = new AjaxModel();
            User      user  = new Entity.User();

            try
            {
                if (bllSession.IUserBLL.GetUserByEmail(Email) != null)
                {
                    model.Statu = "err";
                    model.Msg   = "该邮箱已经存在!";
                }
                else
                {
                    IBLL.IUserBLL bll = BLLSessionFactory.GetBLLSession().IUserBLL;
                    user = bll.GetUserByName(Username);
                    if (user != null)
                    {
                        model.Statu = "err";
                        model.Msg   = "该用户名已经存在!";
                    }
                    else
                    {
                        user          = new Entity.User();
                        user.Username = Username.Trim();
                        user.Password = Encryt.GetMD5(Password.Trim());
                        user.Time     = DateTime.Now;
                        user.Email    = Email;
                        bll.Insert(user);
                        model.Statu = "ok";
                        model.Msg   = "注册用户成功!";
                    }
                }
            }
            catch
            {
                model.Statu = "err";
                model.Msg   = "注册用户出错请重试!";
            }
            return(Json(model));
        }
Ejemplo n.º 4
0
 private IBLL.IUserBLL _userBLL;// = new UserBLL();
 public LoginController(IBLL.IUserBLL userbll)
 {
     _userBLL = userbll;
 }