Exemplo n.º 1
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                if (MembershipService.ValidateUser(model.UserName, model.Password))
                {
                    var userEntity = SetupFormsAuthTicket(model.UserName, model.RememberMe);

                    if (userEntity.LastLoginDate == null)
                    {
                        return RedirectToRoute("AdminUpdateProfile");
                    }
                    if (!String.IsNullOrEmpty(returnUrl))
                    {
                        return Redirect(returnUrl);
                    }
                    return RedirectToRoute("AdminIndex");
                }
                ModelState.AddModelError("", "Username/password provided is incorrect.");
            }

            // If we got this far, something failed, redisplay form
            model.Title = SettingsRepository.BlogName;
            return View(model);
        }
Exemplo n.º 2
0
        // **************************************
        // URL: /Account/LogOn
        // **************************************

        public ActionResult LogOn()
        {
            if (Request.IsAuthenticated)
            {
                return RedirectToRoute("AdminIndex");
            }

            var logOnModel = new LogOnModel { Title = SettingsRepository.BlogName };
            return View(logOnModel);
        }