* @return void
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- // Implement this!
- $this->partialStub("Please implement this method.");
+ // Get both emails
+ $email1 = $requestInstance->getRequestElement('email1');
+ $email2 = $requestInstance->getRequestElement('email2');
+
+ // Is only first email set?
+ if ((!empty($email1)) && (empty($email2))) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Email 2 is empty
+ $responseInstance->addFatalMessage('email2_empty');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Is only second email set?
+ if ((empty($email1)) && (!empty($email2))) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Email 1 is empty
+ $responseInstance->addFatalMessage('email1_empty');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Do both match?
+ if ($email1 != $email2) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Emails are mismatching
+ $responseInstance->addFatalMessage('emails_mismatch');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Now, get a user instance for comparison
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Get the email field
+ $userEmail = $userInstance->getField('email');
+
+ // Are they different?
+ if ($email != $email1) {
+ // Update the "new_email" field
+ $this->partialStub("Unfinished part.");
+ } // END - if
}
}