$emailFilteredValue = ValidationHelper::isEmail($emailValue); if ($emailValue == "" || $emailValue == FormFieldTexts::EMAIL) { $error = "Please enter email"; $focusId = "email"; } else { if ($emailFilteredValue === false) { $error = "Please enter a valid email address"; $focusId = "email"; } else { if (!UserHelper::emailExists($db, $emailFilteredValue)) { $error = "The email address you entered has not been registered: {$emailFilteredValue}"; $focusId = "email"; } else { // all good $showForm = false; $emailResult = UserHelper::forgotPassword($db, $emailFilteredValue); if (!$emailResult) { $error = "Could not send password reset email"; } else { $message = "Your password has been reset and emailed to you"; } } } } } else { $emailFilteredValue = "email"; } if (!$showForm) { $tInner->insertBlock("FORM_CONTENT", ""); $tInner->insertBlock("INSTRUCTION_CONTENT", ""); } else {