X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=application%2Fshipsimu%2Fmain%2Flogin%2Fhelper%2Fclass_ShipSimuLoginHelper.php;fp=application%2Fshipsimu%2Fmain%2Flogin%2Fhelper%2Fclass_ShipSimuLoginHelper.php;h=0000000000000000000000000000000000000000;hp=b5c125e0eba87acc4fcd848f97816029df6d555f;hb=bacc5f4ac0c29e8d038e8cb3938eab902f9e96ca;hpb=c05766cedd51503851746bbb7b5fb8d2f3e87a74 diff --git a/application/shipsimu/main/login/helper/class_ShipSimuLoginHelper.php b/application/shipsimu/main/login/helper/class_ShipSimuLoginHelper.php deleted file mode 100644 index b5c125e..0000000 --- a/application/shipsimu/main/login/helper/class_ShipSimuLoginHelper.php +++ /dev/null @@ -1,114 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -class ShipSimuLoginHelper extends BaseLoginHelper implements HelpableLogin { - /** - * The login method we shall choose - */ - private $authMethod = ""; - - // Exception constants - const EXCEPTION_INVALID_USER_INSTANCE = 0x190; - - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - } - - /** - * Creates an instance of this class by given request instance - * - * @param $requestInstance An instance of a Requestable class - * @return $helperInstance An instance of this helper class - * @throws UserInstanceMissingException If the user instance in registry - * is missing or invalid - */ - public static final function createShipSimuLoginHelper (Requestable $requestInstance) { - // Get a new instance first - $helperInstance = new ShipSimuLoginHelper(); - - // Get a user instance from registry - $userInstance = Registry::getRegistry()->getInstance('user'); - - // Is this instance valid? - if (!$userInstance instanceof ManageableAccount) { - // Thrown an exception here - throw new UserInstanceMissingException (array($helperInstance, 'user'), self::EXCEPTION_INVALID_USER_INSTANCE); - } // END - if - - // Set default login method from config - $helperInstance->setDefaultAuthMethod(); - - // Set request instance - $helperInstance->setRequestInstance($requestInstance); - - // Return the prepared instance - return $helperInstance; - } - - /** - * Setter for default login method from config - * - * @return void - */ - protected function setDefaultAuthMethod () { - $this->authMethod = $this->getConfigInstance()->getConfigEntry('auth_method_class'); - } - - /** - * Execute the login request by given response instance. This instance can - * be used for sending cookies or at least the session id out. - * - * @param $responseInstance An instance of a Responseable class - * @return void - */ - public function executeLogin (Responseable $responseInstance) { - // Get an instance from the login method - $loginInstance = ObjectFactory::createObjectByName($this->authMethod, array($responseInstance)); - - // Set user cookie - $loginInstance->setUserAuth($this->getRequestInstance()->getRequestElement('username')); - - // Set password cookie - $loginInstance->setPasswordAuth($this->getRequestInstance()->getRequestElement('pass_hash')); - - // Remember this login instance for later usage - Registry::getRegistry()->addInstance('login', $loginInstance); - } -} - -// -?>