/** * Validate the form */ private function validateForm() { // is the form submitted if ($this->frm->isSubmitted()) { // get field $txtEmail = $this->frm->getField('email'); // field is filled in? if ($txtEmail->isFilled(FL::getError('EmailIsRequired'))) { // valid email? if ($txtEmail->isEmail(FL::getError('EmailIsInvalid'))) { // email exists? if (FrontendProfilesModel::existsByEmail($txtEmail->getValue())) { // get profile id using the filled in email $profileId = FrontendProfilesModel::getIdByEmail($txtEmail->getValue()); // get profile $profile = FrontendProfilesModel::get($profileId); // must be inactive if ($profile->getStatus() != FrontendProfilesAuthentication::LOGIN_INACTIVE) { $txtEmail->addError(FL::getError('ProfileIsActive')); } } else { $txtEmail->addError(FL::getError('EmailIsInvalid')); } } } // valid login if ($this->frm->isCorrect()) { // activation URL $mailValues['activationUrl'] = SITE_URL . FrontendNavigation::getURLForBlock('profiles', 'activate') . '/' . $profile->getSetting('activation_key'); // trigger event FrontendModel::triggerEvent('profiles', 'after_resend_activation', array('id' => $profileId)); // send email FrontendMailer::addEmail(FL::getMessage('RegisterSubject'), FRONTEND_MODULES_PATH . '/profiles/layout/templates/mails/register.tpl', $mailValues, $profile->getEmail(), ''); // redirect $this->redirect(SELF . '?sent=true'); } else { $this->tpl->assign('resendActivationHasError', true); } } }