public function indexAction()
 {
     // shares/avatar files are deleted by an off-line routine in crontab
     $request = $this->getRequest();
     $registry = Zend_Registry::getInstance();
     $auth = Zend_Auth::getInstance();
     $credential = Ml_Model_Credential::getInstance();
     $peopleDelete = Ml_Model_PeopleDelete::getInstance();
     $signedUserInfo = $registry->get("signedUserInfo");
     $form = $peopleDelete->deleteAccountForm();
     if ($request->isPost()) {
         $credentialInfo = $credential->getByUid($auth->getIdentity());
         if (!$credentialInfo) {
             throw new Exception("Fatal error on checking credential in account delete controller.");
         }
         $registry->set('credentialInfoDataForPasswordChange', $credentialInfo);
         if ($form->isValid($request->getPost())) {
             $registry->set("canDeleteAccount", true);
             $peopleDelete->deleteAccount($signedUserInfo, sha1(serialize($signedUserInfo)));
             $auth->clearIdentity();
             Zend_Session::namespaceUnset('Zend_Auth');
             Zend_Session::regenerateId();
             Zend_Session::destroy(true);
             $this->_redirect("/account/terminated", array("exit"));
         }
     }
     $this->view->deleteAccountForm = $form;
 }
示例#2
0
 public function deleteAction()
 {
     $registry = Zend_Registry::getInstance();
     $service = new Ml_Model_Service();
     $timecheck = new Ml_Model_Timecheck();
     $people = Ml_Model_People::getInstance();
     $peopleDelete = Ml_Model_PeopleDelete::getInstance();
     $service->putString("WARNING!\n========\n");
     $service->putString("DON'T type the user data. Use COPY/PASTE.\n");
     $service->requestConfirmAction("Delete user");
     $timecheck->reset();
     $enteredUserId = $service->getInput("Delete User of id: ");
     $timecheck->check(60);
     $timecheck->reset();
     $enteredUserAlias = $service->getInput("Delete User of alias: ");
     $timecheck->check(40);
     $userInfo = $people->getById($enteredUserId);
     if (!is_array($userInfo)) {
         die("User Not Found by ID.\n");
     }
     if ($userInfo['id'] != $enteredUserId) {
         throw new Exception("Wrong ID retrieved?");
     }
     if ($userInfo['alias'] != $enteredUserAlias) {
         die("Alias does NOT match user id. Please, be careful.\n");
     }
     $service->putString("USER INFORMATION\n=================\n");
     $service->putString(print_r($userInfo, true));
     $timecheck->reset();
     $service->requestConfirmAction("Please DO confirm alias, email, name and id.\n\nDelete this user");
     $service->requestConfirmAction("Confirm");
     $timecheck->check(180);
     $service->putString("Sleeping for three seconds.\nAfter that, deleting the user. Use ^C to cancel\n");
     sleep(3);
     $registry->set("canDeleteAccount", true);
     $peopleDelete->deleteAccount($userInfo, sha1(serialize($userInfo)));
     echo "User account deleted.\n";
 }