public ActionResult Login(Shaka.Model.User user, string returnUrl) { //测试 user.UserId ="admin"; user.UserPwd = "admin"; //1、界面值验证验证 if (user.UserId == null || user.UserId.Trim().Length < 4) { //用户名不可以少于4位 } if (user.UserPwd == null || user.UserPwd.Trim().Length < 6) { //密码不可以少于6位 } //2、用户名错误还是密码错误 Shaka.BLL.User userBLL = new Shaka.BLL.User(); Shaka.Model.User userDB = null; try { userDB = userBLL.GetUser(user.UserId, user.UserPwd); } catch (Exception ex) { //1、日志记录错误 _log.Fatal(ex); //2、界面弹出错误 //3、返回信息 return View(user); } if (userDB == null) { //用户ID不存在 return View(user); } else if (string.IsNullOrEmpty(userDB.UserPwd)) { //用户PWD错误 return View(user); } //单点登陆 if (IsLogin(userDB.UserId, userDB.UserName)) { } return RedirectToLocal(returnUrl); }
public ActionResult Login(Shaka.Model.User user, string returnUrl) { //测试 user.UserId = "admin"; user.UserPwd = "admin"; //1、界面值验证验证 if (user.UserId == null || user.UserId.Trim().Length < 4) { //用户名不可以少于4位 } if (user.UserPwd == null || user.UserPwd.Trim().Length < 6) { //密码不可以少于6位 } //2、用户名错误还是密码错误 Shaka.BLL.User userBLL = new Shaka.BLL.User(); Shaka.Model.User userDB = null; try { userDB = userBLL.GetUser(user.UserId, user.UserPwd); } catch (Exception ex) { //1、日志记录错误 _log.Fatal(ex); //2、界面弹出错误 //3、返回信息 return(View(user)); } if (userDB == null) { //用户ID不存在 return(View(user)); } else if (string.IsNullOrEmpty(userDB.UserPwd)) { //用户PWD错误 return(View(user)); } //单点登陆 if (IsLogin(userDB.UserId, userDB.UserName)) { } return(RedirectToLocal(returnUrl)); }