]> git.mxchange.org Git - shipsimu.git/commitdiff
Cleanup of old stuff.
authorRoland Haeder <roland@mxchange.org>
Sat, 18 Apr 2015 10:30:59 +0000 (12:30 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 18 Apr 2015 10:30:59 +0000 (12:30 +0200)
Signed-off-by: Roland Haeder <roland@mxchange.org>
application/shipsimu/main/login/class_ShipSimuGuestLogin.php
application/shipsimu/main/login/class_ShipSimuUserLogin.php
application/shipsimu/templates/de/code/login_form.ctp
core

index 16f76ed73a57fa82a87035e9caa4e4b074f03b87..97254495c9d185b027abcb8ae55f762bbe3a58ee 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser {
+class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser, Registerable {
        /**
         * The hashed password
         */
@@ -58,36 +58,12 @@ class ShipSimuGuestLogin extends BaseFrameworkSystem implements LoginableUser {
         * @param       $requestInstance        An instance of a Requestable class
         * @param       $responseInstance       An instance of a Responseable class
         * @return      void
-        * @throws      UserAuthMethodException If wether username nor email login
-        *                                                                              was detected
-        * @throws      MissingMethodException          If a method was not found in the
-        *                                                                              User class
         * @throws      UserPasswordMismatchException   If the supplied password did not
         *                                                                              match with the stored password
         */
        public function doLogin (Requestable $requestInstance, Responseable $responseInstance) {
-               // By default no method is selected
-               $method = null;
-               $data = "";
-
-               // Detect login method (username or email) and try to get a userinstance
-               if (!is_null($requestInstance->getRequestElement('user'))) {
-                       // Username found!
-                       $method = 'createGuestByUsername';
-                       $data = $requestInstance->getRequestElement('user');
-               } // END - if
-
-               // Is a method detected?
-               if (is_null($method)) {
-                       // Then abort here
-                       throw new UserAuthMethodException($this, self::EXCEPTION_MISSING_METHOD);
-               } elseif (!method_exists($this->getConfigInstance()->getConfigEntry('guest_class'), $method)) {
-                       // The method is invalid!
-                       throw new MissingMethodException(array($this, $method), self::EXCEPTION_MISSING_METHOD);
-               }
-
                // Get a user instance
-               $userInstance = call_user_func_array(array($this->getConfigInstance()->getConfigEntry('guest_class'), $method), array($data));
+               $userInstance = LoginFactory::createLoginObjectByRequest($requestInstance);
 
                // Remember this new instance in registry
                Registry::getRegistry()->addInstance('user', $userInstance);
index cf43ef00b50e9e7a2b1083078eacff409cc47659..0b3cf7c2424b97642ca313f6d08b6179957bdbfd 100644 (file)
@@ -21,7 +21,7 @@
  * 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 ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
+class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser, Registerable {
        /**
         * The hashed password
         */
@@ -65,15 +65,8 @@ class ShipSimuUserLogin extends BaseFrameworkSystem implements LoginableUser {
         * @todo        user account.
         */
        public function doLogin (Requestable $requestInstance, Responseable $responseInstance) {
-               // By default no method is selected
-               $method = null;
-               $data = "";
-
-               // Get member class
-               $userClass = $this->getConfigInstance()->getConfigEntry('user_class');
-
                // Get a user instance
-               $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance));
+               $userInstance = LoginFactory::createLoginObjectByRequest($requestInstance);
 
                // Remember this new instance in registry
                Registry::getRegistry()->addInstance('user', $userInstance);
index 9de613a0dfc59841286574ccc7b203593304a43c..b8a52e2aa89b7ae1771d4d97b0b9fd90e5f70e6c 100644 (file)
@@ -4,29 +4,30 @@
 // BaseHelper.
 $helperInstance = ObjectFactory::createObjectByConfiguredName('html_form_helper_class', array($this, 'shipsimu_user_login'));
 
-// Formular deaktiviert?
+// Is the form enabled?
 if ($helperInstance->ifLoginIsEnabled()) {
-       // Formular ist aktiv
+       // Form is active
        $helperInstance->addFormGroup('login', "Gebe hier deine Logindaten ein:");
 
-       // Welches Loginverfahren wurde konfiguriert?
+       // Which login method has been configured?
        if ($helperInstance->ifLoginWithUsername()) {
-               // Login mit Username
+               // 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 mit Email
+               // 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 mit Email/Username
+               // 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');
@@ -42,7 +43,7 @@ if ($helperInstance->ifLoginIsEnabled()) {
        $helperInstance->addInputResetButton("Formular leeren");
        $helperInstance->addInputSubmitButton("Zum Spiel einloggen");
 } else {
-       // Formular deaktiviert
+       // Form is inactive
        $helperInstance->addFormNote('form_deactivated', "Einloggen in&#39;s Spiel ist derzeit administrativ deaktiviert worden. Bitte komme sp&auml;ter noch mal wieder.");
        $helperInstance->addFormNote('admin_notice', "Nachricht vom Admin: <span id=\"disabled_reason\">".$this->getConfigInstance()->readConfig('login_disabled_reason')."</span>");
 }
diff --git a/core b/core
index 57d9c524afef252f209990a35283970907890c03..7260d8e4851a8c34a98a72e77e2ec2d8d136cf7a 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 57d9c524afef252f209990a35283970907890c03
+Subproject commit 7260d8e4851a8c34a98a72e77e2ec2d8d136cf7a