function ajaxAdminPW($param = NULL) { try { if (empty($_POST["pwNew"]) || empty($_POST["pwConfirm"])) { throw new Exception("Password cannot be empty."); } $userOperator = new UserBatchOperator(); if (!$this->user->isAdmin) { throw new Exception("Access Denied"); } $userOperator->adminSetPassword($param["userId"], $_POST["pwNew"], $_POST["pwConfirm"]); $result["error"] = 0; $result["msg"] = "Amendment is successful"; } catch (Exception $ex) { $result["error"] = 1; $result["msg"] = $ex->getMessage(); } echo json_encode($result); }