Exemple #1
0
 public ActionResult Login(AccountViewModel.Login model, string returnUrl)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     if (ModelState.IsValid)
     {
         var user = UserManager.Find(model.UserName, model.Password);
         if (user != null)
         {
             HttpRequestExt.SetLogin(user, model.RememberMe);
             return(RedirectToLocal(returnUrl));
         }
         else
         {
             ModelState.AddModelError("Password", "用户名或密码错误");
         }
     }
     // 如果我们进行到这一步时某个地方出错,则重新显示表单
     return(View(model));
 }
 private static bool IsLogin(HttpRequest request, HttpResponse response)
 {
     return(HttpRequestExt.IsLogined());
 }
Exemple #3
0
 //
 // GET: /Account/Logout
 public ActionResult Logout()
 {
     HttpRequestExt.Logout();
     return(RedirectToAction("Login", "Account"));
 }