Exemplo n.º 1
0
        public ActionResult Login(LoginModel model)
        {
            if (model.IsValid())
            {
                return Redirect("/user/apps");
            }

            model.Msg = "bir sorun oluştu";
            return View(model);
        }
Exemplo n.º 2
0
        public async Task<ActionResult> Login(LoginModel model)
        {
            if (!model.IsValid())
            {
                model.Msg = "bir sorun oluştu";
                return View(model);
            }

            var authenticated = await _userService.Authenticate(model.Email, model.Password);
            if (!authenticated)
            {
                model.Msg = "bir sorun oluştu";
                return View(model);
            }

            var user = await _userService.GetByEmail(model.Email);
            _formsAuthenticationService.SignIn(string.Format("{0}|{1}", user.Id, user.Name), true);

            return Redirect("/user/apps");
        }