コード例 #1
0
ファイル: LoginController.cs プロジェクト: johnkors/studiomsg
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            bool userValid = model.Password == "nrkstudio";

            // User found in the database
            if(userValid)
            {

                FormsAuthentication.SetAuthCookie("testcookie", true);
                if(Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/")
                    && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return RedirectToAction("Index", "Home");
                }
            }

            // If we got this far, something failed, redisplay form
            model.IsLoginAttemptWithWrongPassword = true;
            return RedirectToAction("Index", model);
        }
コード例 #2
0
ファイル: LoginController.cs プロジェクト: johnkors/studiomsg
 public ActionResult Index(LoginModel model)
 {
     return View(model);
 }