示例#1
0
        public ActionResult ChangePassword(UserUpdatePassViewModel _userProfileModel)
        {
            if (ModelState.IsValid)
            {
                var userId = _userProfileModel.userId;

                if (UserManager.CheckPassword(UserManager.FindById(userId), _userProfileModel.oldPass))
                {
                    if (_userProfileModel.newPass == _userProfileModel.confirmnewPass)
                    {
                        UserManager.RemovePassword(userId);
                        UserManager.AddPassword(userId, _userProfileModel.newPass);

                        var _url = Url.Action("ChangePassPartialView", "Account", new { user_id = userId });

                        return(Json(new { success = true, url = _url }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = false, errmsg = "invalid password confirmation" },
                                    JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult ChangePassPartialView(string user_id)
        {
            var userUpdatePass = new UserUpdatePassViewModel();

            userUpdatePass.userId = user_id;

            return(PartialView("_changepassPartialView", userUpdatePass));
        }