예제 #1
0
 /**
  * Reopen a blocked account.
  *
  * This will fail if someone set a new password on the account while it was blocked
  */
 public function reopen_account()
 {
     $account = new midcom_core_account($this->_person);
     if ($account->get_password()) {
         $this->_person->set_parameter('org_openpsa_user_blocked_account', 'account_password', "");
         $msg = 'Person with id #' . $this->_person->id . ' does have a password so will not be set to the old one -- Account unblocked';
         throw new midcom_error($msg);
     }
     $account->set_password($this->_person->get_parameter('org_openpsa_user_blocked_account', 'account_password'), false);
     $account->save();
     $this->_person->delete_parameter('org_openpsa_user_blocked_account', 'account_password');
 }