00001 <?php 00024 class LoginAfterRegistrationAction extends BaseAction implements PerformableAction { 00030 protected function __construct () { 00031 // Call parent constructor 00032 parent::__construct(__CLASS__); 00033 } 00034 00040 public final static function createLoginAfterRegistrationAction () { 00041 // Get a new instance 00042 $actionInstance = new LoginAfterRegistrationAction(); 00043 00044 // Return the instance 00045 return $actionInstance; 00046 } 00047 00055 public function execute (Requestable $requestInstance, Responseable $responseInstance) { 00056 // Get a login class from factory 00057 $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class'); 00058 00059 // Login the user by the request instance 00060 $loginInstance->doLogin($requestInstance, $responseInstance); 00061 00062 // Was the login fine? Then redirect here 00063 if ($loginInstance->ifLoginWasSuccessfull()) { 00064 // Try to redirect here 00065 try { 00066 // Redirect... 00067 $responseInstance->redirectToConfiguredUrl('app_login_url'); 00068 00069 // Stop here 00070 exit(); 00071 } catch (FrameworkException $e) { 00072 // Something went wrong here! 00073 $responseInstance->addFatalMessage($e->getMessage()); 00074 } 00075 } else { 00076 // Attach error message to the response 00077 $responseInstance->addFatalMessage('failed_login_after_registration'); 00078 } 00079 } 00080 } 00081 00082 // [EOF] 00083 ?>
1.5.6