]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/filter/validator/class_EmailValidatorFilter.php
CAPTCHA code now gets validated
[shipsimu.git] / inc / classes / main / filter / validator / class_EmailValidatorFilter.php
index 37e207d7b373a8abe83f317594f04fec419af862..4785a9653cbff6eb5df1efa0653894729b01c467 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /**
  * A concrete filter for validating the email address. This filter may intercept
- * the filter chain if no email address is given or if the supplied username has
- * an invalid form. It could also intercept the filter chain if the email
- * address is already used by some one if configuration requires this.
+ * the filter chain if no email address is given or if the supplied email has an
+ * invalid form. It could also intercept the filter chain if the email address
+ * is already used by some one if configuration requires this.
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
@@ -24,7 +24,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
+class EmailValidatorFilter extends BaseFilter implements Filterable {
        /**
         * Protected constructor
         *
@@ -38,11 +38,7 @@ class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
                $this->setObjectDescription("A filter for Email validation");
 
                // Create unique ID number
-               $this->createUniqueID();
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
+               $this->generateUniqueId();
        }
 
        /**
@@ -110,6 +106,15 @@ class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
                                // Add a message to the response
                                $responseInstance->addFatalMessage('email_taken');
 
+                               // Abort here
+                               return false;
+                       } elseif ($email1 != $email2) {
+                               // Emails didn't match
+                               $requestInstance->requestIsValid(false);
+
+                               // Add a message to the response
+                               $responseInstance->addFatalMessage('emails_mismatch');
+
                                // Abort here
                                return false;
                        } // END - elseif
@@ -148,7 +153,7 @@ class EmailValidatorFilter extends BaseFrameworkSystem implements Filterable {
                        $userInstance->setEmailAddress($email);
                } else {
                        // If this instance is created then the username *does* exist
-                       $userInstance = User::createUserByEmail($email);
+                       $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByEmail"), array($email));
 
                        // Remember this user instance in our registry for later usage
                        $registry->addInstance('user', $userInstance);