コード例 #1
0
ファイル: UsersController.cs プロジェクト: darakeon/dfm
        public IActionResult Login(String email, String password)
        {
            var model =
                new UsersLoginModel
            {
                Email    = email,
                Password = password,
            };

            return(json(() => new { ticket = model.LogOn() }));
        }
コード例 #2
0
 public ActionResult Login(UsersLoginModel usersLoginModel)
 {
     if (ModelState.IsValid)
     {
         if (userService.EntityExists(e => e.UserName == usersLoginModel.UserName && e.Password == usersLoginModel.Password && !e.IsDeleted && e.IsActive))
         {
             FormsAuthentication.SetAuthCookie(usersLoginModel.UserName, usersLoginModel.RememberMe);
             return(RedirectToAction("Index"));
         }
         ViewBag.Message = "User Name or Password is incorrect!";
         return(View(usersLoginModel));
     }
     ViewBag.Message = "User Name or Password is invalid!";
     return(View(usersLoginModel));
 }