- // 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);
- }
-