ShipSimuUserLogin.doLogin ( Requestable requestInstance,
Responseable responseInstance 
)

Logins the user with the given request containing the credential.

The result of the login can be thrown by exception or, if prefered stored in a boolean attribute which is then readable by a matching getter.

Parameters:
$requestInstance An instance of a Requestable class
$responseInstance An instance of a Responseable class
Returns:
void
Exceptions:
UserPasswordMismatchException If the supplied password did not match with the stored password
Todo:
We need to add something here which will make more than one
Todo:
guest logins, users who are online but based on the same
Todo:
user account.

Implements LoginableUser.

Definition at line 71 of file class_ShipSimuUserLogin.php.

References BaseFrameworkSystem.$userInstance, ObjectFactory.createObjectByConfiguredName(), BaseUser.EXCEPTION_USER_PASS_MISMATCH, BaseFrameworkSystem.getConfigInstance(), and Registry.getRegistry().

00071                                                                                                {
00072                 // By default no method is selected
00073                 $method = null;
00074                 $data = "";
00075 
00076                 // Get a instance of the registry
00077                 $userInstance = Registry::getRegistry()->getInstance('user');
00078 
00079                 // Is there an instance?
00080                 if (is_null($userInstance)) {
00081                         // Get member class
00082                         $userClass = $this->getConfigInstance()->readConfig('user_class');
00083 
00084                         // Get a user instance
00085                         $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance));
00086 
00087                         // Remember this new instance in registry
00088                         Registry::getRegistry()->addInstance($userInstance);
00089                 } // END - if
00090 
00091                 // Is the password correct?
00092                 if ($userInstance->ifPasswordHashMatches($requestInstance) === false) {
00093                         // Mismatching password
00094                         throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
00095                 } // END - if
00096 
00097                 // ToDo place
00098 
00099                 // Now do the real login. This can be cookie- or session-based login
00100                 // which depends on the admins setting then on the user's taste.
00101                 // 1) Get a login helper instance
00102                 $helperInstance = ObjectFactory::createObjectByConfiguredName('login_helper_class', array($requestInstance));
00103 
00104                 // 2) Execute the login. This will now login...
00105                 $helperInstance->executeLogin($responseInstance);
00106         }

Here is the call graph for this function:


Generated on Mon Dec 8 01:18:42 2008 for Ship-Simulator by  doxygen 1.5.6