Exemplo n.º 1
0
        public ActionResult Index(LoginViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (this._loginProvider.Login(viewModel.Username, viewModel.Password, false).Successful)
                    {
                        FormsAuthentication.SetAuthCookie(viewModel.Username, false);
                        return this.RedirectToRoute(AdminRoutes.Home);
                    }
                    else
                    {
                        this.ModelState.AddModelError("Username", "Invalid username or password, please try again");
                    }
                }
                catch (Exception exception)
                {
                    this.ModelState.AddModelError("Username", "There was a problem logging you in. Please try again." + exception.Message);
                }
            }

            return this.Index();
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            LoginViewModel viewModel = new LoginViewModel();

            return View("Index", viewModel);
        }