Пример #1
0
 /**
  * Activates the user or returns an error message
  * 
  * @access protected
  * @param string $uuid
  * @param string $activationToken
  * @return array
  */
 protected function activateUser($uuid, $activationToken)
 {
     // Check the uuid
     if (!$this->userManager->hasUserForUuid($uuid)) {
         return array('result' => false, 'message' => $this->translate('Account with the given UUID does not exist.', '\\Zepi\\Web\\AccessControl'));
     }
     // Compare the activation token
     $user = $this->userManager->getUserForUuid($uuid);
     if ($user->getMetaData('activationToken') !== $activationToken) {
         return array('result' => false, 'message' => $this->translate('The given activation token is not valid.', '\\Zepi\\Web\\AccessControl'));
     }
     // Remove the disabled access level
     $this->accessControlManager->revokePermission($uuid, get_class($user), '\\Global\\Disabled');
     $this->accessControlManager->grantPermission($uuid, get_class($user), '\\Global\\Active', 'Activation');
     return array('result' => true, 'message' => $this->translate('Your account was activated successfully.', '\\Zepi\\Web\\AccessControl'));
 }