Example #1
0
        public ActionResult Login(LoginModel model, string service)
        {
            this.ViewBag.service = service;

            //if (!WebSecurity.IsConfirmed(model.UserName))
            //{

            //    return RedirectToAction("EmailActivation", "Account", new { email = model.UserName, type = 1 });
            //}


            string redirectUrl;
            // check if this is a CAS request and handle it
            if (this.ModelState.IsValid && this.casServer.HandlePageLogin(
                service, model.UserName, model.Password, model.RememberMe, out redirectUrl))
            {
                if (string.IsNullOrEmpty(redirectUrl))
                {
                    // if not, do it the FormsAuthentication way
                    //FormsAuthentication.RedirectFromLoginPage(model.UserName, model.RememberMe);

                    return this.Redirect(Dev.CasServer.Configuration.CasServerConfiguration.Config.DefaultUrl);
                }
                else
                {
                    return this.Redirect(redirectUrl);
                }
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            //ViewBag.ErrorMessage = "提供的用户名或密码不正确。";
            this.ModelState.AddModelError("", "提供的用户名或密码不正确。");
            return View(model);
        }
Example #2
0
 public ActionResult Login(LoginModel model, string returnUrl)
 {
     return new HttpUnauthorizedResult();
 }