From 001114501684814a9126d5c306a98f4a659e3c48 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 22 Aug 2009 12:46:58 +0000 Subject: [PATCH] Missing class/config entries added, execeute() implemented, some rewrites: - Missing menu class for failed login attempt (e.g. expired auth cookie) added - execute() method (partly) implemented in government commands - Double quotes to single converted - Misc minor rewrites --- .gitattributes | 1 + application/ship-simu/config.php | 9 ++++ ...ss_WebShipsimuGovernmentStartupCommand.php | 8 ++- ...s_WebShipsimuGovernmentTrainingCommand.php | 6 ++- .../menu/class_ShipSimuLoginFailedMenu.php | 50 +++++++++++++++++++ .../class_ShipSimuRegistration.php | 8 +-- .../class_UserGovernmentDatabaseWrapper.php | 10 ++++ 7 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 application/ship-simu/main/menu/class_ShipSimuLoginFailedMenu.php diff --git a/.gitattributes b/.gitattributes index bc11e79..97850f8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -152,6 +152,7 @@ application/ship-simu/main/menu/class_ShipSimu -text application/ship-simu/main/menu/class_ShipSimuConfirmMenu.php -text application/ship-simu/main/menu/class_ShipSimuHomeMenu.php -text application/ship-simu/main/menu/class_ShipSimuLoginAreaMenu.php -text +application/ship-simu/main/menu/class_ShipSimuLoginFailedMenu.php -text application/ship-simu/main/menu/class_ShipSimuLoginMenu.php -text application/ship-simu/main/menu/class_ShipSimuLogoutMenu.php -text application/ship-simu/main/menu/class_ShipSimuRegisterMenu.php -text diff --git a/application/ship-simu/config.php b/application/ship-simu/config.php index 3514596..363450b 100644 --- a/application/ship-simu/config.php +++ b/application/ship-simu/config.php @@ -106,6 +106,9 @@ $cfg->setConfigEntry('app_login_url', 'index.php?app={?app_short_name?}&page // CFG: LOGIN-FAILED-URL $cfg->setConfigEntry('login_failed_url', 'index.php?app={?app_short_name?}&page=login_failed'); +// CFG: LOGIN-FAILED-LOGIN-RETRY-ACTION-URL +$cfg->setConfigEntry('login_failed_login_retry_action_url', 'index.php?app={?app_short_name?}&page=login&note=login_failed'); + // CFG: LOGOUT-DONE-URL $cfg->setConfigEntry('logout_done_url', 'index.php?app={?app_short_name?}&page=logout_done'); @@ -241,6 +244,9 @@ $cfg->setConfigEntry('captcha_register_verifier_filter', 'GraphicalCodeCaptchaVe // CFG: CAPTCHA-REFILL-VERFIER-FILTER $cfg->setConfigEntry('captcha_refill_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter'); +// CFG: CAPTCHA-GOVERNMENT-VERFIER-FILTER +$cfg->setConfigEntry('captcha_government_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter'); + // CFG: CAPTCHA-PROFILE-VERFIER-FILTER $cfg->setConfigEntry('captcha_profile_verifier_filter', 'GraphicalCodeCaptchaVerifierFilter'); @@ -460,6 +466,9 @@ $cfg->setConfigEntry('login_register_login_form', 'index.php?app={?app_short_nam // CFG: HOME-MENU-CLASS $cfg->setConfigEntry('home_menu_class', 'ShipSimuHomeMenu'); +// CFG: LOGIN-FAILED-MENU-CLASS +$cfg->setConfigEntry('login_failed_menu_class', 'ShipSimuLoginFailedMenu'); + // CFG: STATUS-MENU-CLASS $cfg->setConfigEntry('status_menu_class', 'ShipSimuStatusMenu'); diff --git a/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php b/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php index 4464074..fd6cb12 100644 --- a/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php +++ b/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentStartupCommand.php @@ -59,7 +59,11 @@ class WebShipsimuGovernmentStartupCommand extends BaseCommand implements Command * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - $this->partialStub('Unfinished method.'); + // Get a wrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); + + // Register the startup help + $wrapperInstance->registerStartupHelpByRequest($requestInstance); } /** @@ -84,7 +88,7 @@ class WebShipsimuGovernmentStartupCommand extends BaseCommand implements Command $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('account_password_filter')); // Verify CAPTCHA code - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_refill_verifier_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_government_verifier_filter')); } } diff --git a/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php b/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php index a399674..a5ec956 100644 --- a/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php +++ b/application/ship-simu/main/commands/web/government/class_WebShipsimuGovernmentTrainingCommand.php @@ -57,7 +57,11 @@ class WebShipsimuGovernmentTrainingCommand extends BaseCommand implements Comman * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - $this->partialStub('Unfinished method.'); + // Get a wrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_gov_wrapper_class'); + + // Register the training + $wrapperInstance->registerTrainingByRequest($requestInstance); } /** diff --git a/application/ship-simu/main/menu/class_ShipSimuLoginFailedMenu.php b/application/ship-simu/main/menu/class_ShipSimuLoginFailedMenu.php new file mode 100644 index 0000000..013dd84 --- /dev/null +++ b/application/ship-simu/main/menu/class_ShipSimuLoginFailedMenu.php @@ -0,0 +1,50 @@ + + * @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.ship-simu.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 ShipSimuLoginFailedMenu extends BaseMenu implements RenderableMenu { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $menuInstance An instance of this class + */ + public final static function createShipSimuLoginFailedMenu () { + // Get a new instance + $menuInstance = new ShipSimuLoginFailedMenu(); + + // Return the prepared instance + return $menuInstance; + } +} + +// [EOF] +?> diff --git a/application/ship-simu/main/registration/class_ShipSimuRegistration.php b/application/ship-simu/main/registration/class_ShipSimuRegistration.php index 31add01..8b5398e 100644 --- a/application/ship-simu/main/registration/class_ShipSimuRegistration.php +++ b/application/ship-simu/main/registration/class_ShipSimuRegistration.php @@ -25,7 +25,7 @@ class ShipSimuRegistration extends BaseRegistration implements UserRegister { /** * Hashed password */ - private $hashedPassword = ""; + private $hashedPassword = ''; /** * Elements for criteria @@ -160,7 +160,7 @@ class ShipSimuRegistration extends BaseRegistration implements UserRegister { $configEntry = 'user_status_unconfirmed'; // Is the confirmation process entirely disabled? - if ($this->getConfigInstance()->getConfigEntry('confirm_email_enabled') === "N") { + if ($this->getConfigInstance()->getConfigEntry('confirm_email_enabled') === 'N') { // No confirmation of email needed $configEntry = 'user_status_confirmed'; } // END - if @@ -177,7 +177,7 @@ class ShipSimuRegistration extends BaseRegistration implements UserRegister { } // Is this a guest account? - if ((($element == "username") || ($alias == "username")) && ($this->getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->getConfigEntry('guest_login_user'))) { + if ((($element == 'username') || ($alias == 'username')) && ($this->getRequestInstance()->getRequestElement($element) == $this->getConfigInstance()->getConfigEntry('guest_login_user'))) { // Yes, then set the config entry to guest status $configEntry = 'user_status_guest'; } // END - if @@ -190,7 +190,7 @@ class ShipSimuRegistration extends BaseRegistration implements UserRegister { $criteriaInstance->addConfiguredCriteria(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $configEntry); // Include registration timestamp - $criteriaInstance->addCriteria("registered", date("Y-m-d H:i:s", time())); + $criteriaInstance->addCriteria('registered', date('Y-m-d H:i:s', time())); } } diff --git a/application/ship-simu/main/wrapper/class_UserGovernmentDatabaseWrapper.php b/application/ship-simu/main/wrapper/class_UserGovernmentDatabaseWrapper.php index 2bf1035..428b04e 100644 --- a/application/ship-simu/main/wrapper/class_UserGovernmentDatabaseWrapper.php +++ b/application/ship-simu/main/wrapper/class_UserGovernmentDatabaseWrapper.php @@ -54,6 +54,16 @@ class UserGovernmentDatabaseWrapper extends BaseDatabaseWrapper { // Return the instance return $wrapperInstance; } + + /** + * Registers the given startup help request with the government + * + * @param $requestInstance A Requestable instance + * @return void + */ + public function registerStartupHelpByRequest (Requestable $requestInstance) { + $requestInstance->debugInstance(); + } } // [EOF] -- 2.39.5