/*
This action is for AJAX request.  It is updated user state
964467
public function actionUserState ()
		{
			$userClass = $this->module->modelUser;
			$post = Yii::$app->request->post();
			$user = $userClass::findOne($post[ 'id' ]);
			if (!is_null($user))
			{
				$user->active = $post[ 'state' ];
				$user->save();
			}
			echo $post[ 'state' ];

			Yii::$app->end();
		}
56754
function handlePermissionUpdate() {
            permissionArea.find("form").submit(function (e) {
                e.preventDefault();
                //console.log(e);
                var form = e.currentTarget;
                appendFormFields(form);
                Rocket.Util.submitFormAsync(form, function (responseData) {
                    //console.log(responseData);
                    if (responseData && responseData.status && responseData.status == "success") {
                        location.reload();
                    }
                });
            });
        }
708909
@Override
	public void handleRequest(final Request request) {
		if (isDisabled()) {
			// Protect against client-side tampering of disabled/read-only fields.
			return;
		}

		// Remember which client side tab we were on.
		String[] indicesStr = request.getParameterValues(getId());

		if (indicesStr != null && indicesStr.length > 0) {
			List<Integer> oldIndices = getActiveIndices();
			List<Integer> changes = new ArrayList<>(1);
			int[] indices = new int[indicesStr.length];

			if (Util.empty(indicesStr[0])) {
				// Special case - no tab selected
				if (getType() == TYPE_ACCORDION) {
					indices = null;
				} else {
					int idx = findFirstVisibleTab();
					indices = new int[idx];
				}
			} else {
				// Normal case - one or more tabs selected
				for (int i = 0; i < indices.length; i++) {
					int clientIndex = Integer.parseInt(indicesStr[i]);
					int idx = clientIndexToTabIndex(clientIndex);
					indices[i] = idx;

					if (!oldIndices.contains(idx)) {
						// Check for a server mode tab and set focus
						WTab tab = getTab(idx);
						if (TabMode.SERVER.equals(tab.getMode()) && UIContextHolder.getCurrent().getFocussed() == null) {
							tab.setFocussed();
						}
						changes.add(idx);
					}
				}
			}

			setActiveIndices(indices);

			// Invoke action if tab selection has changed
			final Action action = getActionOnChange();

			if (action != null && !changes.isEmpty()) {
				final ActionEvent event = new ActionEvent(this, changes.toString(), null);

				Runnable later = new Runnable() {
					@Override
					public void run() {
						action.execute(event);
					}
				};

				invokeLater(later);
			}
		}

		String showHeadOnlyStr = request.getParameter(getId() + ".showHeadOnly");

		if (showHeadOnlyStr != null) {
			boolean showHeadOnly = "true".equals(showHeadOnlyStr);
			setShowHeadOnly(showHeadOnly);
		}
	}
625073
public function indexAction()
    {
        if ($this->getRequest()->isAjax()) {
            try {
                $this->loadLayout(null, false, false);
                $this->getLayout()->getUpdate()->setCacheId(null);
                $this->getLayout()->getUpdate()->addHandle(strtolower($this->getFullActionName()) . '_AJAX');
            } catch (Exception $e) {
                Mage::logException($e);
                $this->getResponse()->setHeader('Content-Type', 'application/json');
                $this->getResponse()->setBody(Zend_Json::encode(['error' => true, 'message' => $e->getMessage()]));
            }
        }

        $this->loadLayout();
        $this->renderLayout();
    }
560008
function(member) {
            users = $module.data('users');
            if(member.id != 'anonymous' && users[ member.id ] === undefined ) {
              users[ member.id ] = member.info;
              if(settings.randomColor && member.info.color === undefined) {
                member.info.color = settings.templates.color(member.id);
              }
              html = settings.templates.userList(member.info);
              if(member.info.isAdmin) {
                $(html)
                  .prependTo($userList)
                ;
              }
              else {
                $(html)
                  .appendTo($userList)
                ;
              }
              if(settings.partingMessages) {
                $log
                  .append( settings.templates.joined(member.info) )
                ;
                module.message.scroll.test();
              }
              module.user.updateCount();
            }
          }
428454
function onChangePassword() {
  var password = $('#changed-password').val();
  activeUser().updatePassword(password).then(function() {
    refreshUserData();
    alertSuccess('Password changed!');
  }, onAuthError);
}
704906
public function updateSelect($id = null) {
		//$this->autoRender = false;
		if (!$this->request->is('post') || !$this->request->is('ajax')) {
			throw new Exception(__('not a valid request'));
		}
		$this->viewBuilder()->layout('ajax');
		$states = $this->States->getListByCountry($id);
		$defaultFieldLabel = 'pleaseSelect';
		if ($this->request->query('optional')) {
			$defaultFieldLabel = 'doesNotMatter';
		}

		$this->set(compact('states', 'defaultFieldLabel'));
	}
893748
public function actionRevoke()
    {
        if (isset($_GET['itemName'], $_GET['userId'])) {
            $itemName = $_GET['itemName'];
            $userId = $_GET['userId'];

            /* @var $am CAuthManager|AuthBehavior */
            $am = Yii::app()->getAuthManager();

            if ($am->isAssigned($itemName, $userId)) {
                $am->revoke($itemName, $userId);
                if ($am instanceof CPhpAuthManager) {
                    $am->save();
                }

                if ($am instanceof ICachedAuthManager) {
                    $am->flushAccess($itemName, $userId);
                }
            }

            if (!isset($_POST['ajax'])) {
                $this->redirect(array('view', 'id' => $userId));
            }
        } else {
            throw new CHttpException(400, Yii::t('AuthModule.main', 'Invalid request.'));
        }
    }
15675
function onApplyActionCode() {
  var code = $('#email-verification-code').val();
  auth.applyActionCode(code).then(function() {
    alertSuccess('Email successfully verified!');
    refreshUserData();
  }, onAuthError);
}
1250355
function(method, url, async, user, password) {
      this.user = user
      this.password = password
      this.url = url
      this.readyState = 1
      this.method = method.toUpperCase()
      if (async != undefined) this.async = async
      if (this.async) this.onreadystatechange()
    }
886111
function update() {
    var $this = this,
      self = User.resourceConstructor().call(this, this.id);

    return self.update.apply(self, arguments).then(function (updated) {
      Utils.extend($this, updated, true);
      return updated;
    });
  }
1164100
private function runAjaxRequest()
    {
        // Ajax request.
        // @codingStandardsIgnoreStart - We need POST access here.
        if (!($_POST && Environment::get('isAjaxRequest'))) // @codingStandardsIgnoreEnd
        {
            return null;
        }

        $ajax = new Ajax(Input::post('action'));
        $ajax->executePreActions();

        return $ajax;
    }
479470
public final synchronized void refresh( HttpServletRequest request, HttpServletResponse response )
    {
        PerRequestState prevState = setPerRequestState( new PerRequestState( request, response, null ) );

        try
        {
            onRefresh();
        }
        finally
        {
            setPerRequestState( prevState );
        }
    }
569277
function handleStatusChange(response) {
  if (response.authResponse) {
    logResponse(response);
    window.location.hash = '#menu';
    updateUserInfo(response);
  } else {
    window.location.hash = '#login';
  }
}
93071
private static function changeStateRequest()
    {
        self::$id = self::$config['id'];
        $that = self::getInstance();
        $state = $that->changeState();

        $response = [
            'state' => $state,
            'errors' => self::$errors,
        ];

        echo json_encode($response);
    }
763446
function () {
            var self = this;
            var originalDeleteAction = self.options.actions.deleteAction;
            self.options.actions.deleteAction = function (postData) {
                return $.Deferred(function ($dfd) {

                    var input = $.extend({}, postData);

                    originalDeleteAction.method(input)
                        .done(function (result) {
                            $dfd.resolve({
                                "Result": "OK",
                                originalResult: result
                            });
                        })
                        .fail(function (error) {
                            self._handlerForFailOnAbpRequest($dfd, error);
                        });
                });
            };
        }
525333
function update(user, callback) {
      var cb = callback || angular.noop;

      return User.update(user,
        function (user) {
          return cb(user);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }