* @return void
* @throws UserAuthorizationException If the auth login was not found or if it was invalid
* @throws UserPasswordMismatchException If the supplied password hash does not match
+ * @throws ClassNotFoundException If the user (guest/member) class was not found
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Then get an auth instance for checking and updating the auth cookies
// Now, try to get a user or guest instance
if ($authLogin == $this->getConfigInstance()->readConfig('guest_login_user')) {
- // Guest login!
- $userInstance = Guest::createGuestByUserName($authLogin);
+ // Set class
+ $className = $this->getConfigInstance()->readConfig('guest_class');
+ $methodName = 'createGuestByUserName';
} else {
// Regular user account
- $userInstance = Member::createUserByUserName($authLogin);
+ $className = $this->getConfigInstance()->readConfig('user_class');
+ $methodName = 'createMemberByUserName';
}
+ // Does the guest class exist?
+ if (!class_exists($className)) {
+ // Then abort here
+ throw new ClassNotFoundException (array($this, $className), self::EXCEPTION_CLASS_NOT_FOUND);
+ } // END - if
+
+ // Now try the dynamic login
+ $userInstance = call_user_func_array(array($className, $methodName), array($authLogin));
+
// Is the password correct?
if ($userInstance->getPasswordHash() !== $authHash) {
// Mismatching password