* @param $requestInstance An instance of a class with an Requestable interface
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
+ * @throws InvalidInterfaceException If the user class does not implement ManageableUser
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Does the user instance implement ManageableUser?
+ if (!$userInstance instanceof ManageableUser) {
+ // Throw exception here
+ throw new InvalidInterfaceException(array($userInstance, 'ManageableUser'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
+ } // END - if
+
// Get template instance
$templateInstance = $responseInstance->getTemplateInstance();
// Assign base URL
$templateInstance->assignConfigVariable('base_url');
+ // Get a RNG instance (Random Number Generator)
+ $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
+
+ // Generate a pseudo-random string
+ $randomString = $rngInstance->randomString(255);
+
+ // Get a crypto instance
+ $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+
+ // Hash and encrypt the string
+ $hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
+
+ // Update the user class
+ $userInstance->updateDatabaseField('confirm_hash', $hashedString);
+
// Get a mailer class
$mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance));