//if (models.Password.IndexOfAny(UPPERCHAR) == -1)
        //       {
        //           check = true;
        //           error = "Password phải chứa ký tự hoa!";
        //       }
        //       if (models.Password.IndexOfAny(NUMBER) == -1)
        //       {
        //           check = true;
        //           error = "Password phải chứa số!";
        //       }
        //       if (models.ID != 0)
        //       {
        //           models.VaiTro_ID = currentNd.VAITRO;
        //       }
        public JsonResult UpdateUser(string _password, string _newpasswordRe, string _newpassword)
        {
            string returnedData = "NotOK";

            if (_password.Trim() != "" && _newpassword.Trim().Length >= 8 /* && _newpasswordRe.Trim().Length >= 8 && _password.IndexOfAny(SpecialChars) != -1 && _password.IndexOfAny(UPPERCHAR) != -1 && _password.IndexOfAny(NUMBER) != -1*/)
            {
                var user      = UserDataService.Getbykey(usercurent.userid);
                var pass_word = FormsAuthentication.HashPasswordForStoringInConfigFile(_password, "MD5");

                if (user.password == pass_word)
                {
                    var newpw = FormsAuthentication.HashPasswordForStoringInConfigFile(_newpassword, "MD5");
                    user.password = newpw;
                    UserDataService.Update(user);
                    UserDataService.CommitChanges();
                    returnedData            = "ok";
                    Session["MustChangePW"] = false;
                }
            }

            return(Json(returnedData, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// required implementation
        /// </summary>
        /// <param name="username">a username</param>
        /// <param name="oldPassword">original password</param>
        /// <param name="newPassword">new password</param>
        /// <returns>true or false</returns>
        public bool ChangePassword(string username, string oldPassword, string newPassword)
        {
            log.Info("ChangePassword user: "******" in Application: " + _App.AppName);

            if (_App == null)
            {
                return(false);
            }
            user TemUser = UserSrv.GetByName(username, _App.AppID);

            if (TemUser == null)
            {
                return(false);
            }
            string OldPassWordHash = FormsAuthentication.HashPasswordForStoringInConfigFile(oldPassword, "MD5");

            if (TemUser.password != OldPassWordHash)
            {
                return(false);
            }
            string NewPassWordHash = FormsAuthentication.HashPasswordForStoringInConfigFile(newPassword, "MD5");

            TemUser.password = NewPassWordHash;

            try
            {
                UserSrv.Update(TemUser);
                UserSrv.CommitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                log.Error("ERR in ChangePassword user: "******" in Application " + _App.AppName, ex);
                return(false);
            }
        }