Ejemplo n.º 1
0
        public ActionResult ChangePassword(ChangePasswordModel model, string returnUrl)
        {
            if (!Actor.Public.IsAuthenticated)
            {
                return RedirectToAction("Logon");
            }
            Bzure.Security.IAccountContract AccountContract = Actor.Public.AsAccountManager();
            if (AccountContract.ValidateUser(Actor.Me.Principal.Identity.Name, AccountContract.EncryptPassword(model.OldPassword)))
            {
                string msg = string.Empty;
                if (AccountContract.SetPassword(Actor.Me.Principal.Identity.Name, AccountContract.EncryptPassword(model.NewPassword)))
                {
                    msg = "密码修改成功";
                }
                else
                {
                    msg = "密码修改失败,请重试";
                }

                ChangePasswordViewModel ViewModel = new ChangePasswordViewModel()
                {
                    Title = "修改密码",
                    UserName = Actor.Me.Principal.Identity.Name,
                    MasterViewModel = this.MasterViewModel,
                    Message = msg
                };
                return Result(ViewModel);
            }
            else
            {
                return RedirectToAction("Logon");
            }
        }
Ejemplo n.º 2
0
 public ActionResult ChangePassword()
 {
     ChangePasswordViewModel ViewModel = new ChangePasswordViewModel()
     {
         Title = "修改密码",
         UserName = Actor.Me.Principal.Identity.Name,
         MasterViewModel = this.MasterViewModel
     };
     return Result(ViewModel);
 }