*/ /** * This controller will handle the confirmation-link that is sent in the confirmation email * * @package SelfRegistration * @subpackage UserInterface * */ class ConfirmRegistrationController extends GalleryController { /** * @see GalleryController::handleRequest */ function handleRequest($form) { GalleryCoreApi::requireOnce(dirname(__FILE__) . '/classes/GalleryPendingUserHelper.class'); global $gallery; $results = array(); $results['redirect'] = array(); $results['status'] = array(); $results['error'] = array(); /* turn the pending user into a real user */ list ($username, $regKey) = GalleryUtilities::getRequestVariables('username', 'key'); list($ret, $user) = GalleryPendingUserHelper::fetchPendingUserByUsername($username); if ($ret->isError()) { if ($ret->getErrorCode() & ERROR_MISSING_OBJECT) { $results['error'][] = 'form[error][unknownUser]'; } else { return array($ret->wrap(__FILE__, __LINE__), null); } } else { // verify registration key: if ($regKey != $user->getRegistrationKey()) { $results['error'][] = 'form[error][unknownUser]'; } else { $ret = GalleryPendingUserHelper::createGalleryUser($user); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } } } $results['delegate']['view'] = 'core:UserAdmin'; $results['delegate']['subView'] = 'register:ConfirmRegistration'; return array(GalleryStatus::success(), $results); } } /** * This view shows a confirmation that the users account was activated * * @package Selfregistration * @subpackage UserInterface */ class ConfirmRegistrationView extends GalleryView { /** * @see GalleryView::loadTemplate */ function loadTemplate(&$template, &$form) { global $gallery; $template->setVariable('controller', 'register:ConfirmRegistration'); return array(GalleryStatus::success(), array('body' => 'modules/register/templates/ConfirmRegistration.tpl')); } } ?>