public ActionResult LogIn(LoginModel model, string rtnUrl) { string uid = model.UserName; string pwd = model.Pwd; LoginResult result = loginService.CheckLogin(uid, pwd); Customer customer = authService.GetCustomer(uid); switch (result) { case LoginResult.Success: loginService.SingIn(customer); rtnUrl = HttpUtility.UrlDecode(rtnUrl); if (!string.IsNullOrEmpty(rtnUrl)) { return Redirect(rtnUrl); } else { return RedirectToAction("ShowInfo", "Maka"); } case LoginResult.NotExist: ModelState.AddModelError("UserName", "用户名不存在!"); break; case LoginResult.PwdError: ModelState.AddModelError("Pwd", "密码输入错误!"); break; case LoginResult.IsNotActive: ModelState.AddModelError("UserName", "用户未激活!"); break; default: break; } return View(model); }
public ActionResult Index(LoginModel model) { return View("LogIn", model); }