- // Detect login method (username or email) and try to get a userinstance
- if (!is_null($requestInstance->getRequestElement('username'))) {
- // Username found!
- $method = "createUserByUsername";
- $data = $requestInstance->getRequestElement('username');
- } elseif (!is_null($requestInstance->getRequestElement('email'))) {
- // Email found!
- $method = "createUserByEmail";
- $data = $requestInstance->getRequestElement('email');
- }
-
- // Is a method detected?
- if (is_null($method)) {
- // Then abort here
- throw new UserAuthMethodException($this, self::EXCEPTION_MISSING_METHOD);
- } elseif (!method_exists($this->getConfigInstance()->readConfig('user_class'), $method)) {
- // The method is invalid!
- throw new MissingMethodException(array($this, $method), self::EXCEPTION_MISSING_METHOD);
- }
-
- // Get a instance of the registry
- $userInstance = Registry::getRegistry()->getInstance('user');
-
- // Is there an instance?
- if (is_null($userInstance)) {
- // Get a user instance
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), $method), array($data));
-
- // Remember this new instance in registry
- Registry::getRegistry()->addInstance($userInstance);
- } // END - if
+ // Get member class
+ $userClass = $this->getConfigInstance()->getConfigEntry('user_class');
+
+ // Get a user instance
+ $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance));
+
+ // Remember this new instance in registry
+ Registry::getRegistry()->addInstance('user', $userInstance);