$cfg->setConfigEntry('chat_enabled_msn', 'Y');
// CFG: CITY-REGISTER-CAPTCHA-SECURED
-$cfg->setConfigEntry('city_register_captcha_secured', 'Y');
+$cfg->setConfigEntry('city_register_captcha_secured', 'N');
// CFG: CITY-USER-LOGIN-CAPTCHA-SECURED
-$cfg->setConfigEntry('city_user_login_captcha_secured', 'Y');
+$cfg->setConfigEntry('city_user_login_captcha_secured', 'N');
// CFG: CITY-GUEST-LOGIN-CAPTCHA-SECURED
-$cfg->setConfigEntry('city_guest_login_captcha_secured', 'Y');
+$cfg->setConfigEntry('city_guest_login_captcha_secured', 'N');
// CFG: CITY-PROFILE-CAPTCHA-SECURED
-$cfg->setConfigEntry('city_profile_captcha_secured', 'Y');
+$cfg->setConfigEntry('city_profile_captcha_secured', 'N');
// CFG: CITY-REFILL-CAPTCHA-SECURED
-$cfg->setConfigEntry('city_refill_captcha_secured', 'Y');
+$cfg->setConfigEntry('city_refill_captcha_secured', 'N');
// CFG: CITY-GOVERNMENT-STARTUP-CAPTCHA-SECURED
-$cfg->setConfigEntry('city_government_startup_captcha_secured', 'Y');
+$cfg->setConfigEntry('city_government_startup_captcha_secured', 'N');
// CFG: CITY-GOVERNMENT-TRAINING-CAPTCHA-SECURED
-$cfg->setConfigEntry('city_government_training_captcha_secured', 'Y');
+$cfg->setConfigEntry('city_government_training_captcha_secured', 'N');
// CFG: CITY-REGISTER-CAPTCHA-CLASS
$cfg->setConfigEntry('city_register_captcha_class', 'GraphicalCodeCaptcha');
// CFG: PAYMENT-DB-WRAPPER-CLASS
$cfg->setConfigEntry('payment_db_wrapper_class', 'PaymentsDatabaseWrapper');
+// CFG: LOGIN-ENABLED
+$cfg->setConfigEntry('login_enabled', 'Y');
+
+// CFG: LOGIN-TYPE (username, email, both)
+$cfg->setConfigEntry('login_type', 'username');
+
/******************************************************************************
* Console client *
******************************************************************************/
--- /dev/null
+<?php
+/**
+ * A command for guest logins
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City 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 <http://www.gnu.org/licenses/>.
+ */
+class HtmlCityGuestLoginCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this command and sets the resolver instance
+ *
+ * @param $resolverInstance An instance of a command resolver
+ * @return $commandInstance The created command instance
+ */
+ public static final function createHtmlCityGuestLoginCommand (CommandResolver $resolverInstance) {
+ // Get a new instance
+ $commandInstance = new HtmlCityGuestLoginCommand();
+
+ // Set the resolver instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // First get a GuestLogin instance
+ $loginInstance = ObjectFactory::createObjectByConfiguredName('guest_login_class');
+
+ // First set request and response instance
+ $loginInstance->setRequestInstance($requestInstance);
+
+ // Encrypt the password
+ $loginInstance->encryptPassword('passwd');
+
+ // Do the login here
+ $loginInstance->doLogin($requestInstance, $responseInstance);
+
+ // Was the login fine? Then redirect here
+ if ($loginInstance->ifLoginWasSuccessfull()) {
+ // Try to redirect here
+ try {
+ // Redirect...
+ $responseInstance->redirectToConfiguredUrl('app_login');
+
+ // Exit here
+ exit();
+ } catch (FrameworkException $e) {
+ // Something went wrong here!
+ $responseInstance->addFatalMessage($e->getMessage());
+ }
+ } else {
+ // Attach error message to the response
+ $responseInstance->addFatalMessage('failed_user_login');
+ }
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ * @todo Add more filters
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Add username verifier filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_guest_verifier_filter'));
+
+ // Add password verifier filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('passwd_guest_verifier_filter'));
+
+ // Add CAPTCHA verifier code
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_guest_verifier_filter'));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command for user login
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City 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 <http://www.gnu.org/licenses/>.
+ */
+class HtmlCityUserLoginCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this command and sets the resolver instance
+ *
+ * @param $resolverInstance An instance of a command resolver
+ * @return $commandInstance The created command instance
+ */
+ public static final function createHtmlCityUserLoginCommand (CommandResolver $resolverInstance) {
+ // Get a new instance
+ $commandInstance = new HtmlCityUserLoginCommand();
+
+ // Set the resolver instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // First get a UserLogin instance
+ $loginInstance = ObjectFactory::createObjectByConfiguredName('user_login_class');
+
+ // First set request and response instance
+ $loginInstance->setRequestInstance($requestInstance);
+
+ // Encrypt the password
+ $loginInstance->encryptPassword('pass');
+
+ // Do the login here
+ $loginInstance->doLogin($requestInstance, $responseInstance);
+
+ // Was the login fine? Then redirect here
+ if ($loginInstance->ifLoginWasSuccessfull()) {
+ // Try to redirect here
+ try {
+ // Redirect...
+ $responseInstance->redirectToConfiguredUrl('app_login');
+
+ // Exit here
+ exit();
+ } catch (FrameworkException $e) {
+ // Something went wrong here!
+ $responseInstance->addFatalMessage($e->getMessage());
+ }
+ } else {
+ // Attach error message to the response
+ $responseInstance->addFatalMessage('failed_user_login');
+ }
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ * @todo Add more filters
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Which login type do we have?
+ switch ($this->getConfigInstance()->getConfigEntry('login_type')) {
+ case 'username': // Login via username
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_filter'));
+ break;
+
+ case 'email': // Login via email
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('email_verifier_filter'));
+ break;
+
+ default: // Wether username or email is set
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_email_verifier_filter'));
+ break;
+ }
+
+ // Password verifier filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('password_verifier_filter'));
+
+ // Add filter for CAPTCHA
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_user_verifier_filter'));
+ }
+}
+
+// [EOF]
+?>
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
+
+ // Init additional filter chains
+ foreach (array('shutdown') as $filterChain) {
+ $this->initFilterChain($filterChain);
+ } // END - foreach
}
/**
</div>
<div id="main_content">
+ {?main_content?}
{?content?}
</div>
--- /dev/null
+<?php
+// Get helper instance for web forms. This will add the opening form-tag to
+// the helper's render cache which is simply a small variable in the class
+// BaseHelper.
+$helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', array($this, 'city_user_login'));
+
+// Is the form enabled?
+if ($helperInstance->ifLoginIsEnabled()) {
+ // Form is active
+ $helperInstance->addFormGroup('login', "Gebe hier deine Logindaten ein:");
+
+ // Which login method has been configured?
+ if ($helperInstance->ifLoginWithUsername()) {
+ // Login with user name only
+ $helperInstance->addFormSubGroup('username', "Bitte mit deinem Nickname einloggen.");
+ $helperInstance->addFieldText('username', "Dein Nickname:");
+ $helperInstance->addInputTextField('username');
+ } elseif ($helperInstance->ifLoginWithEmail()) {
+ // Login with email address only
+ $helperInstance->addFormSubGroup('email', "Bitte mit deiner Email-Adresse einloggen.");
+ $helperInstance->addFieldText('email', "Deine Email-Addresse:");
+ $helperInstance->addInputTextField('email');
+ } else {
+ // Login with email address or user name
+ $helperInstance->addFormSubGroup('user_email', "Bitte mit deinem Nickname oder Email-Adresse einloggen.");
+ $helperInstance->addFieldText('user_email', "Dein Nickname/Email:");
+ $helperInstance->addInputTextField('user_email');
+ }
+
+ // Add password input field
+ $helperInstance->addFormSubGroup('pass', "Gebe dein Passwort von der Anmeldung ein.");
+ $helperInstance->addFieldText('pass', "Dein Passwort:");
+ $helperInstance->addInputPasswordField('pass');
+
+ // CAPTCHA enabled?
+ if ($helperInstance->ifFormSecuredWithCaptcha()) {
+ $helperInstance->addFormGroup('captcha_user', "Das Benutzer-Login ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du dich einloggen kannst.");
+ $helperInstance->addCaptcha();
+ } // END - if
+
+ // Submit buttons
+ $helperInstance->addFormGroup('buttons_user', "Alles richtig eingegeben?");
+ $helperInstance->addInputResetButton("Formular leeren");
+ $helperInstance->addInputSubmitButton("Zum Spiel einloggen");
+} else {
+ // Form is inactive
+ $helperInstance->addFormNote('form_deactivated', "Einloggen in's Spiel ist derzeit administrativ deaktiviert worden. Bitte komme später noch mal wieder.");
+ $helperInstance->addFormNote('admin_notice', "Nachricht vom Admin: <span id=\"disabled_reason\">".$this->getConfigInstance()->readConfig('login_disabled_reason')."</span>");
+}
+
+// Formular schliessen
+$helperInstance->flushContent();
+
+// Ist Gastlogin erlaubt?
+if ($helperInstance->ifGuestLoginAllowed()) {
+ // Neue Helper-Instanz holen
+ $helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', array($this, 'city_guest_login'));
+ $helperInstance->addInputHiddenConfiguredField('user', 'guest_login');
+ $helperInstance->addInputHiddenConfiguredField('passwd', 'guest_login');
+
+ // CAPTCHA enbaled?
+ if ($helperInstance->ifFormSecuredWithCaptcha()) {
+ $helperInstance->addFormGroup('captcha_guest', "Unser Gast-Login ist durch ein CAPTCHA geschützt. Bitte wiederhole den angezeigten Code, damit du dich einloggen kannst.");
+ $helperInstance->addCaptcha();
+ } // END - if
+
+ // Submit button
+ $helperInstance->addFormGroup('buttons_guest', "Gastlogins sind in der Funkionsweise eingeschränkt. Mehr dazu unter "Gastlogin".");
+ $helperInstance->addInputSubmitButton("Als Gast einloggen");
+ $helperInstance->flushContent();
+}
+
+// Get helper instance
+$helperInstance = ObjectFactory::createObjectByConfiguredName('html_link_helper_class', array($this, 'register'));
+
+// Set link text
+$helperInstance->addLinkWithTextById('register_login');
+
+// Flush the content
+$helperInstance->flushContent();
+
+// [EOC]
+?>
+<div id="content_header">
+ Einloggen zu <span class="app_name">{?app_full_name?}</span>
+</div>
+
+<div id="content_body">
+ <div id="login_box">
+ {?city_user_login?}
+ </div>
+
+ <div id="guest_login">
+ {?city_guest_login?}
+ </div>
+</div>
+
+<div id="content_footer">
+ Noch kein Spieleaccount? {?register?}
+</div>
-Subproject commit 57d9c524afef252f209990a35283970907890c03
+Subproject commit 50591deeef32ed14e5f6c297c3633e378686ff2c