Example #1
0
        public ActionResult LogOn(LogonModel model, string returnUrl)
        {
            IAccountContract AccountContract = Actor.Public.AsAccountManager();
            if (AccountContract.ValidateUser(model.UserName, AccountContract.EncryptPassword(model.Password)))
            {
                BzureUser user = AccountContract.GetUserByName(model.UserName);

                user.SignIn(model.RememberMe);
                if (Url.IsLocalUrl(returnUrl))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return Redirect("/");
                }
            }
            else
            {
                LogonViewModel ViewModel = new LogonViewModel()
                {
                    Title = "用户登录",
                    Message = "用户名或密码不正确",
                    MasterViewModel = this.MasterViewModel
                };
                return this.Result(ViewModel);

            }
        }
Example #2
0
 public ActionResult LogOn()
 {
     string msg = string.Empty;
     if (this.Request.Params.AllKeys.Contains("code"))
     {
         string code = this.Request.Params["code"];
         if (code.IsNotNullAndEmpty() && code == "1")
         {
             msg = "用户不具备足够的权限,请更换用户重新登录";
         }
     }
     LogonViewModel ViewModel = new LogonViewModel
     {
         Title = "登录",
         Message = msg,
         MasterViewModel = this.MasterViewModel
     };
     return this.Result(ViewModel);
 }