コード例 #1
0
        public async Task <JsonResult> LoginTest(LoginViewModel model)
        {
            ParentModule module = new ParentModule(_context);
//            Users item = new Users();

            IQueryable <Users> item = module.GetParentInfo(model.Email);

            // If we got this far, something failed, redisplay form
            return(Json(item));
        }
コード例 #2
0
        public async Task <JsonResult> Login2(LoginViewModel model)
        {
            ParentModule module = new ParentModule(_context);

            if (ModelState.IsValid)
            {
                // This doesn't count login failures towards account lockout
                // To enable password failures to trigger account lockout, set lockoutOnFailure: true
                var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure : false);

                if (result.Succeeded)
                {
                    _logger.LogInformation(1, "User logged in.");

                    IQueryable <Users> item = module.GetParentInfo(model.Email);
                    return(Json(item));
                }
            }

            // If we got this far, something failed, redisplay form
            return(Json("error"));
        }