diff --git a/Classes/Controller/NewsletterSubscriptionController.php b/Classes/Controller/NewsletterSubscriptionController.php
index d928654..64ba033 100644
--- a/Classes/Controller/NewsletterSubscriptionController.php
+++ b/Classes/Controller/NewsletterSubscriptionController.php
@@ -1,15 +1,28 @@
settings[$rteField] = $this->configurationManager->getContentObject()->parseFunc(
+ $this->settings[$rteField],
+ [],
+ '< lib.parseFunc_RTE'
+ );
+ }
+ }
/**
* Render form action
*
* @return void
*/
- public function formAction() {
-
- $this->initalize();
-
- $this->assignViewVariables();
-
- $this->addJsFooterInlineCode();
-
+ public function formAction()
+ {
+ $this->view->assign(
+ 'ceuid',
+ $this->configurationManager->getContentObject()->getFieldVal('uid')
+ );
}
/**
* Render confirm action
*
- * Renders confirm result as a content element if hash parameter is set
- * @return void
+ * Renders confirm result as a content element
+ *
+ * @param string $status
+ * @param string $hashid
+ * @param string $hash
*/
- public function confirmAction() {
-
- if ( $this->settings['forceFormView'] == 1 ) {
- $this->forward('form', NULL, NULL, $this->request->getArguments());
- }
-
- $hash = GeneralUtility::removeXSS(GeneralUtility::_GP('hash'));
- $status = GeneralUtility::removeXSS(GeneralUtility::_GP('status'));
- $id = intval(GeneralUtility::removeXSS(GeneralUtility::_GP('hashid')));
-
- if ( is_string($hash) && strlen(trim($hash)) > 0 ) {
+ public function confirmAction($status, $hashid, $hash)
+ {
+ $id = intval($hashid);
- if ($status == 'subscribe') {
- $this->confirmSubscription($hash,$id);
- } elseif ($status == 'unsubscribe') {
- $this->unsubscribe($hash,$id);
- }
+ switch ($status) {
+ case self::STATUS_SUBSCRIBE:
+ $this->confirmSubscription($hash, $id);
+ break;
+ case self::STATUS_UNSUBSCRIBE:
+ $this->unSubscribe($hash, $id);
+ break;
}
}
@@ -114,263 +116,173 @@ public function confirmAction() {
* Render ajax action
*
* Ajax action:
- * If hash parameter is set, used to make confirmation, else return result of subscribe/unsubscribe to form in formAction.
+ * Return result of subscribe/unsubscribe
+ *
* @return void
*/
- public function ajaxAction() {
-
- $hash = GeneralUtility::removeXSS(GeneralUtility::_GP('hash'));
-
- if ( is_string($hash) === FALSE || strlen(trim($hash)) == 0 ) {
- $response = $this->runAjax();
- header('Content-type: application/json');
- echo json_encode($response);
- exit;
- } else {
- $status = GeneralUtility::removeXSS(GeneralUtility::_GP('status'));
- $hash = GeneralUtility::removeXSS(GeneralUtility::_GP('hash'));
- $id = intval(GeneralUtility::removeXSS(GeneralUtility::_GP('hashid')));
-
- if ($status == 'subscribe') {
- $this->confirmSubscription($hash,$id);
- } elseif ($status == 'unsubscribe') {
- $this->unsubscribe($hash,$id);
+ public function ajaxAction()
+ {
+ $isNewSubscription = $this->request->hasArgument('submitSubscribe');
+ $arguments = $this->request->getArguments();
+ foreach (['email', 'name'] as $item) {
+ if (array_key_exists($item, $arguments)) {
+ $arguments[$item] = trim($arguments[$item]);
}
}
- }
-
- /**
- * Initialize Controller
- *
- * Setup of properties
- * @return void
- */
- protected function initalize() {
- $contentElementObject = $this->configurationManager->getContentObject()->data;
+ $message = $this->validateSubscription($isNewSubscription, $arguments);
+ $valid = $message === '';
- $this->contentElementUid = $contentElementObject['uid'];
- $this->formName = $this->settings['tagIdPrefix'] . $this->contentElementUid;
-
- if ( $this->isFileAccessible( $this->settings['dynamicJsTemplateFile'] ) ) {
- $this->dynamicJsTemplateFile = $this->settings['dynamicJsTemplateFile'];
- } else {
- $this->messages[] = 'The file with js template is not accesible (' . $this->settings['dynamicJsTemplateFile'] . ')';
+ if ($valid) {
+ // It still could fail ?
+ list($valid, $message) = $this->processSubscription($isNewSubscription, $arguments);
}
+ echo json_encode(
+ [
+ 'success' => $valid,
+ 'message' => $message
+ ]
+ );
+ exit(0);
}
/**
- * Returns the content of dynamicJsTemplateFile with "markers" replaced.
+ * Process subscribe or unsubscribe action
*
- * @return string
+ * @param bool $isNewSubscription
+ * @param array $arguments
+ * @return array
*/
- protected function getProcessedDynamicJavascript() {
-
- $dynamicJsTemplate = $this->getFileContent( $this->dynamicJsTemplateFile );
- $dynamicJsTemplate = str_replace('__FORMNAME__', $this->formName, $dynamicJsTemplate);
-
- return $dynamicJsTemplate;
- }
+ protected function processSubscription($isNewSubscription, $arguments)
+ {
+ // Variables to store message and status
+ $pid = intval($this->settings['saveFolder']);
- /**
- * Adds footer inline code
- *
- * Only adds javascript if function getProcessedDynamicJavascript generated some output.
- *
- */
- protected function addJsFooterInlineCode() {
+ // Check what action to execute
+ if ($isNewSubscription) {
+ // Since name is validated and still can be empty if name isn't mandatory, set empty name from email.
+ $name = empty($arguments['name']) ? $arguments['email'] : $arguments['name'];
+
+ /** @var FrontendUserGroup $frontendUserGroup */
+ $frontendUserGroup = $this->frontendUserGroupRepository->getFrontendUserGroupByUid(
+ $this->settings['userGroup']
+ );
+
+ // Try to create feuser and store it in repository
+ /** @var FrontendUser $frontendUser */
+ $frontendUser = $this->objectManager->get(FrontendUser::class);
+ $frontendUser->setAsSubscriber(
+ $pid,
+ $arguments['email'],
+ $name,
+ $this->settings['enableEmailConfirm'],
+ $frontendUserGroup
+ );
+
+ // Signal slot for after fe_user creation
+ $this->signalSlotDispatcher->dispatch(
+ __CLASS__,
+ 'afterFeUserCreation',
+ [$frontendUser, $this]
+ );
+
+ $this->frontendUserRepository->add($frontendUser);
+ $this->persistenceManager->persistAll();
+
+ // User was created
+ if ($this->settings['enableEmailConfirm']) {
+ /** @var EmailNotificationService $emailNotificationService */
+ $emailNotificationService = GeneralUtility::makeInstance(
+ EmailNotificationService::class,
+ $this->settings
+ );
+
+ $emailNotificationService->sendConfirmationEmail(
+ $frontendUser,
+ $this->getFeLink($frontendUser->getUid(), self::STATUS_SUBSCRIBE),
+ false
+ );
+
+ $message = $this->translate('success.subscribe.subscribed-confirm');
+ } else {
+ // Add user
+ $message = $this->translate('success.subscribe.subscribed-noconfirm');
+ }
- $javascript = $this->getProcessedDynamicJavascript();
+ $success = true;
+ } else {
+ /** @var FrontendUser $frontendUser */
+ $frontendUser = $this->frontendUserRepository->getUserByEmailAndPid($arguments['email'], $pid);
+
+ if ($this->settings['enableEmailConfirm']) {
+ /** @var EmailNotificationService $emailNotificationService */
+ $emailNotificationService = GeneralUtility::makeInstance(
+ EmailNotificationService::class,
+ $this->settings
+ );
+
+ $emailNotificationService->sendConfirmationEmail(
+ $frontendUser,
+ $this->getFeLink($frontendUser->getUid(), self::STATUS_UNSUBSCRIBE),
+ true
+ );
+
+ $message = $this->translate('success.unsubscribe.unsubscribed-confirm');
+ } else {
+ // Set user to deleted
+ $this->frontendUserRepository->remove($frontendUser);
+ $this->persistenceManager->persistAll();
- if ( is_string($javascript) && strlen($javascript) > 0 ) {
- /** @var PageRenderer $pageRenderer */
- $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
- $pageRenderer->addJsFooterInlineCode($this->formName, $javascript);
+ $message = $this->translate('success.unsubscribe.unsubscribed-noconfirm');
+ }
+ $success = true;
}
+ return [$success, $message];
}
/**
- * Assign view variables (formAction,)
+ * Check if data is valid
*
- * @return void
- */
- protected function assignViewVariables() {
-
- $this->view->assign('ceuid',$this->contentElementUid);
- $this->view->assign('displayNameField',$this->isNameVisibleInForm());
- $this->view->assign('formName',$this->formName);
- $this->view->assign('sysLanguageUid', $GLOBALS['TSFE']->sys_language_uid);
-
- }
-
- /**
- * Assign view variables (formAction,)
+ * @param bool $isNewSubscription
+ * @param array $arguments
*
- * @return bool If setup is valid.
+ * @return string Empty if no error
*/
- protected function isConfigurationValid() {
+ protected function validateSubscription($isNewSubscription, $arguments)
+ {
+ $alreadyExist = $this->frontendUserRepository->doesEmailExistInPid(
+ $arguments['email'],
+ intval($this->settings['saveFolder'])
+ );
- $isValid = true;
+ $message = '';
- $frontendUserGroup = $this->frontendUserGroupRepository->getFrontendUserGroupByUid( intval($this->settings['userGroup']) );
- if ( $frontendUserGroup === NULL ) {
- $this->messages[] = 'Frontend Usergroup is not valid.';
- $isValid = false;
+ if (!GeneralUtility::validEmail($arguments['email'])) {
+ $message = $this->translate('error.invalid.email');
+ } elseif ($isNewSubscription && $alreadyExist) {
+ $message = $this->translate('error.subscribe.already-subscribed');
+ } elseif ($isNewSubscription && !$this->isNameValid($arguments['name'])) {
+ $message = $this->translate('error.invalid.name');
+ } elseif ($isNewSubscription && is_null($this->frontendUserGroupRepository->getFrontendUserGroupByUid($this->settings['userGroup']))) {
+ $message = $this->translate('error.subscribe.4101');
+ } elseif (!$isNewSubscription && !$alreadyExist) {
+ $message = $this->translate('error.unsubscribe.not-subscribed');
}
- // $storagePid = intval($this->settings['saveFolder']);
-
-
- // $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr']
-
+ return $message;
}
/**
- * runs ajax
+ * Translate label
*
- * @return array
+ * @param string $key
+ * @return NULL|string
*/
- public function runAjax()
+ protected function translate($key = '')
{
- $name = $this->getArgument('name');
- $email = $this->getArgument('email');
- $submitType = $this->getArgument('submitType');
-
- $pid = intval($this->settings['saveFolder']);
- $confirm = intval($this->settings['enableEmailConfirm']);
- $emailConfirmIsEnabled = intval($this->settings['enableEmailConfirm']) == 1;
- $userGroup = intval($this->settings['userGroup']);
-
- // Variables to store message and status
- $message = '';
- $success = false;
-
- // TODO: VALIDATE CONFIGURATION AND ARGUMENTS BEFORE PROCEEDING !!
- /*
- $configurationIsValid = $this->isConfigurationValid();
- if ( !$configurationIsValid ) {
- if ( $GLOBALS['BE_USER']->user['admin'] == 1 ) {
- $message = '
';
- foreach ($this->messages as $no => $message) {
- $message .= $message
- }
- $message = '
';
- } else {
- $message = LocalizationUtility::translate('error.invalid.configuration', 'pxa_newsletter_subscription');
- }
- }
- */
-
- // Check if email exist in pid
- $emailExist = $this->frontendUserRepository->doesEmailExistInPid( $email, $pid );
-
- // Check what action to execute
- if ( $submitType == LocalizationUtility::translate('unsubscribe', 'pxa_newsletter_subscription') ) {
- // On Unsubscribe
- if ( GeneralUtility::validEmail($email) === FALSE ) {
- // Not a valid email
- $message = LocalizationUtility::translate('error.invalid.email', 'pxa_newsletter_subscription');
- } else {
- if ( $emailExist === FALSE ) {
- // email doesn't exist in pid
- $message = LocalizationUtility::translate('error.unsubscribe.not-subscribed', 'pxa_newsletter_subscription');
- } else {
- if ( $emailConfirmIsEnabled ) {
- // Send unsubscribe email
- $frontendUser = $this->frontendUserRepository->getUserByEmailAndPid($email, $pid);
- if ($frontendUser !== NULL) {
- $this->sendConfirmationEmail($frontendUser->getEmail(), $frontendUser->getName(), $frontendUser->getHash(), $frontendUser->getUid(), TRUE );
- $message = LocalizationUtility::translate('success.unsubscribe.unsubscribed-confirm', 'pxa_newsletter_subscription');
- $success = true;
- } else {
- $message = LocalizationUtility::translate('error.subscribe.4105', 'pxa_newsletter_subscription');
- }
- } else {
- // Set user to deleted
- $frontendUser = $this->frontendUserRepository->getUserByEmailAndPid($email, $pid);
- if ($frontendUser !== NULL) {
- $frontendUser->setDeleted(1);
- $this->frontendUserRepository->update($frontendUser);
- $this->persistenceManager->persistAll();
- if ( $frontendUser->getDeleted() == TRUE ) {
- $message = LocalizationUtility::translate('success.unsubscribe.unsubscribed-noconfirm', 'pxa_newsletter_subscription');
- $success = true;
- } else {
- $message = LocalizationUtility::translate('error.subscribe.4104', 'pxa_newsletter_subscription');
- }
- } else {
- $message = LocalizationUtility::translate('error.subscribe.4103', 'pxa_newsletter_subscription');
- }
- }
- }
- }
- } else {
- // If not Unsubscribe
- if ( GeneralUtility::validEmail($email) === FALSE ) {
- // Not a valid email
- $message = LocalizationUtility::translate('error.invalid.email', 'pxa_newsletter_subscription');
- } else {
- if ( $this->isNameValid($name) === FALSE ) {
- // Not a valid name
- $message = LocalizationUtility::translate('error.invalid.name', 'pxa_newsletter_subscription');
- } else {
- if ( $emailExist ) {
- // Check if disabled, then resend confirmation mail ?
- // email already exist in pid
- $message = LocalizationUtility::translate('error.subscribe.already-subscribed', 'pxa_newsletter_subscription');
- } else {
- /** @var FrontendUserGroup $frontendUserGroup */
- $frontendUserGroup = $this->frontendUserGroupRepository->getFrontendUserGroupByUid($userGroup);
- if ( $frontendUserGroup === NULL ) {
- // Could not load usergroup.
- // TODO: generate email for admin, setup invalid frontend usergroup is invalid.
- $message = LocalizationUtility::translate('error.subscribe.4101', 'pxa_newsletter_subscription');
- } else {
- // Since name is validated and still can be empty if name isn't mandatory, set empty name from email.
- if ( strlen(trim($name)) == 0 ) {
- $name = $email;
- }
- // Try to create feuser and store it in repository
- $frontendUser = $this->objectManager->get(\Pixelant\PxaNewsletterSubscription\Domain\Model\FrontendUser::class);
- $frontendUser->setAsSubscriber( $pid, $email, $name, $emailConfirmIsEnabled, $frontendUserGroup );
-
- // Signal slot for after fe_user creation
- $this->signalSlotDispatcher->dispatch(
- __CLASS__,
- 'afterFeUserCreation',
- array($frontendUser, $this)
- );
-
- $this->frontendUserRepository->add( $frontendUser );
- $this->persistenceManager->persistAll();
-
- if ( $frontendUser->getUid() > 0 ) {
- // User was created
- if ( $emailConfirmIsEnabled ) {
- // Send subscribe email
- $this->sendConfirmationEmail($frontendUser->getEmail(), $frontendUser->getName(), $frontendUser->getHash(), $frontendUser->getUid(), FALSE);
- $message = LocalizationUtility::translate('success.subscribe.subscribed-confirm', 'pxa_newsletter_subscription');
- $success = true;
- } else {
- // Add user
- $message = LocalizationUtility::translate('success.subscribe.subscribed-noconfirm', 'pxa_newsletter_subscription');
- $success = true;
- }
- } else {
- // The feuser was not created.
- $message = LocalizationUtility::translate('error.subscribe.4102', 'pxa_newsletter_subscription') . $frontendUser->getUid();
- }
- }
- }
- }
- }
- }
- return array(
- 'message' => $message,
- 'success' => $success
- );
+ return LocalizationUtility::translate($key, 'pxa_newsletter_subscription');
}
/**
@@ -380,31 +292,31 @@ public function runAjax()
* @param string $id
* @return void
*/
- protected function confirmSubscription($hash,$id) {
-
- $status = true;
-
- try {
+ protected function confirmSubscription($hash, $id)
+ {
+ $status = false;
- $frontendUser = $this->frontendUserRepository->getUserByUidAndHash($id, $hash);
- if ($frontendUser !== NULL) {
+ if ($this->hashService->validateHmac('pxa_newsletter_subscription-subscribe' . $id, $hash)) {
+ /** @var FrontendUser $frontendUser */
+ $frontendUser = $this->frontendUserRepository->findByUid($id);
+ if ($frontendUser !== null && $frontendUser->getDisable()) {
$frontendUser->setDisable(0);
- $this->frontendUserRepository->update($frontendUser);
- $this->persistenceManager->persistAll();
- $message = LocalizationUtility::translate('subscribe_ok', 'pxa_newsletter_subscription');
- }
- } catch (\Exception $e) {
+ $this->frontendUserRepository->update($frontendUser);
+ $message = $this->translate('subscribe_ok');
+ $status = true;
+ }
}
if (!isset($message)) {
- $message = LocalizationUtility::translate('subscribe_error', 'pxa_newsletter_subscription');
- $status = false;
+ $message = $this->translate('subscribe_error');
}
- $this->view->assign('message', $message);
- $this->view->assign('status', $status);
+ $this->view->assignMultiple([
+ 'message' => $message,
+ 'status' => $status
+ ]);
}
/**
@@ -414,65 +326,29 @@ protected function confirmSubscription($hash,$id) {
* @param string $id
* @return void
*/
- protected function unsubscribe($hash,$id)
+ protected function unSubscribe($hash, $id)
{
- $status = true;
+ $status = false;
- try {
- $frontendUser = $this->frontendUserRepository->getUserByUidAndHash($id, $hash);
- if ($frontendUser !== NULL) {
- $frontendUser->setDeleted(1);
- $this->frontendUserRepository->update($frontendUser);
- $this->persistenceManager->persistAll();
- $message = LocalizationUtility::translate('unsubscribe_ok', 'pxa_newsletter_subscription');
- }
- } catch (\Exception $e) {
+ if ($this->hashService->validateHmac('pxa_newsletter_subscription-unsubscribe' . $id, $hash)) {
+ $frontendUser = $this->frontendUserRepository->findByUid($id);
- }
-
- if (!isset($message)) {
- $message = LocalizationUtility::translate('unsubscribe_error', 'pxa_newsletter_subscription');
- $status = false;
- }
+ if ($frontendUser !== null) {
+ $this->frontendUserRepository->remove($frontendUser);
- $this->view->assign('message', $message);
- $this->view->assign('status', $status);
- }
-
- /**
- * Sends a confirmation mail
- *
- * @param string $email Email
- * @param string $name Name
- * @param string $hash Frontenduser computed hash
- * @param int $id Frontenduser id
- * @param bool $unsubscribeMail If the mail is only a unsubscribe mail
- * @return bool
- */
- protected function sendConfirmationEmail($email, $name, $hash, $id, $unsubscribeMail) {
-
- try {
- $mail = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
- $mail->setFrom( $this->getConfirmMailFrom() );
- $mail->setTo( $this->getConfirmMailTo( $name, $email) );
- $mail->setSubject( $this->getConfirmMailSubject() );
- $mail->setBody( $this->getConfirmMailBody($name, $hash, $id, $unsubscribeMail ), 'text/plain' );
-
- if ( GeneralUtility::validEmail($this->settings['confirmMailReplyTo']) === TRUE ) {
- $mail->setReplyTo( $this->settings['confirmMailReplyTo'] );
+ $message = $this->translate('unsubscribe_ok');
+ $status = true;
}
-
- $mail->send();
-
- return $mail->isSent();
-
- } catch (\Exception $e) {
-
- return false;
-
}
+ if (!isset($message)) {
+ $message = $this->translate('unsubscribe_error');
+ }
+ $this->view->assignMultiple([
+ 'message' => $message,
+ 'status' => $status
+ ]);
}
/**
@@ -481,202 +357,27 @@ protected function sendConfirmationEmail($email, $name, $hash, $id, $unsubscribe
* Also, if flexform setting Confirm Page is set, the link is to a page, otherwise it is a ajax link.
*
* @param int $id Frontenduser id
- * @param string $hash Frontenduser computed hash
- * @param bool $unsubscribeLink If true, link is to unsubscribe, default is to subscribe
- * @return string
- */
- protected function getFeLink( $id, $hash, $unsubscribeLink ) {
-
- $mode = $unsubscribeLink ? 'unsubscribe' : 'subscribe';
- $confirmPageId = intval($this->settings['confirmPage']);
-
- $linkParams = array(
- "status" => $mode,
- "hashid" => $id,
- "hash" => $hash,
- );
-
- if ( $confirmPageId > 0 ) {
-
- $feLink = $this
- ->uriBuilder
- ->reset()
- ->setTargetPageUid($confirmPageId)
- ->setArguments($linkParams)
- ->setNoCache(1)
- ->setUseCacheHash(true)
- ->setCreateAbsoluteUri(true)
- ->uriFor('confirm', null, 'NewsletterSubscription');
-
- } else {
-
- $feLink = $this
- ->uriBuilder
- ->reset()
- ->setArguments($linkParams)
- ->setNoCache(1)
- ->setUseCacheHash(true)
- ->setCreateAbsoluteUri(true)
- ->uriFor('ajax', null, 'NewsletterSubscription');
-
- }
-
- return $feLink;
- }
-
- /**
- * Generates the t3lib_mail_Message setFrom array for confirmation mail
- *
- * @return array
- */
- protected function getConfirmMailFrom() {
-
- // Default to Install tool default settings
- $confirmMailSenderName = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'];
- $confirmMailSenderEmail= $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'];
-
- // Override with flexform settings if set and valid
- if ( is_string($this->settings['confirmMailSenderName']) && strlen(trim($this->settings['confirmMailSenderName'])) > 0 ) {
- $confirmMailSenderName = $this->settings['confirmMailSenderName'];
- }
- if ( GeneralUtility::validEmail($this->settings['confirmMailSenderEmail']) ) {
- $confirmMailSenderEmail = $this->settings['confirmMailSenderEmail'];
- }
-
- // If from email is still empty, use a no-reply address
- if ( strlen($confirmMailSenderEmail) == 0 ) {
- // Won't work on all domains!
- $domain = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');
- if (substr($domain,0,3) == 'www') {
- $domain = substr($domain, 4);
- $confirmMailSenderEmail = 'no-reply@' . $domain;
- } else {
- $confirmMailSenderEmail = 'no-reply@' . $domain;
- }
- $confirmMailSenderName = $confirmMailSenderEmail;
- }
-
- if ( strlen($confirmMailSenderName) == 0 ) {
- $confirmMailSenderName = $confirmMailSenderEmail;
- }
-
- if (preg_match('/\\s|,/', $confirmMailSenderName) >= 1) {
- $confirmMailSenderName = '"' . $confirmMailSenderName . '"';
- }
-
- return array( $confirmMailSenderEmail => $confirmMailSenderName );
-
- }
-
- /**
- * Generates the t3lib_mail_Message setTo array for confirmation mail
- *
- * @param string $name Name
- * @param string $email Email
- * @return array
- */
- protected function getConfirmMailTo($name, $email) {
-
- // Set defaults, name same as email
- $confirmMailRecipientName = $email;
- $confirmMailRecipientEmail = $email;
-
- // If name is set, use it
- if ( is_string($name) && strlen(trim($name)) > 0 ) {
- $confirmMailRecipientName = $name;
- }
-
- if (preg_match('/\\s|,/', $confirmMailRecipientName) >= 1) {
- $confirmMailRecipientName = '"' . $confirmMailRecipientName . '"';
- }
-
- return array( $confirmMailRecipientEmail => $confirmMailRecipientName );
- }
-
- /**
- * Generates the t3lib_mail_Message setSubject string for confirmation mail
- *
+ * @param string $status Subscribe or unsubscribe
* @return string
*/
- protected function getConfirmMailSubject() {
-
- // Set defaults subject from translation
- $subject = LocalizationUtility::translate('confirm_mail_subject', 'pxa_newsletter_subscription');
-
- // Override with flexform settings if set and valid
- if ( is_string($this->settings['confirmMailSubject']) && strlen(trim($this->settings['confirmMailSubject'])) > 0 ) {
- $subject = $this->settings['confirmMailSubject'];
- }
- return $subject;
-
- }
-
- /**
- * Generates the t3lib_mail_Message setBody string for confirmation mail
- *
- * @param string $name Name
- * @param string $hash Frontenduser computed hash
- * @param int $id Frontenduser id
- * @param bool $unsubscribeMail If the mail is only a unsubscribe mail
- * @return string
- */
- protected function getConfirmMailBody($name, $hash, $id, $unsubscribeMail) {
-
- $subscribeLink = $this->getFeLink( $id, $hash, false );
- $unsubscribeLink = $this->getFeLink( $id, $hash, true );
-
- // Set defaults from original translation, has replacement in texts
- $bodyText = LocalizationUtility::translate('confirm_mail_greeting', 'pxa_newsletter_subscription',array($name)) . PHP_EOL . PHP_EOL;
- $bodySubscribeLink = LocalizationUtility::translate('confirm_mail_line1', 'pxa_newsletter_subscription', array( PHP_EOL . PHP_EOL . $subscribeLink . PHP_EOL . PHP_EOL));
- $bodyUnsubscribeLink = LocalizationUtility::translate('confirm_mail_line2', 'pxa_newsletter_subscription',array( PHP_EOL . PHP_EOL . $unsubscribeLink . PHP_EOL . PHP_EOL));
- $bodyFooter = '';
-
- // Override with flexform values if set
- if ( $unsubscribeMail ) {
- if ( is_string($this->settings['confirmMailUnsubscribeBody']) && strlen(trim($this->settings['confirmMailUnsubscribeBody'])) > 0 ) {
- $bodyText = $this->settings['confirmMailUnsubscribeBody'] . PHP_EOL . PHP_EOL;
- }
- } else {
- if ( is_string($this->settings['confirmMailSubscribeBody']) && strlen(trim($this->settings['confirmMailSubscribeBody'])) > 0 ) {
- $bodyText = $this->settings['confirmMailSubscribeBody'] . PHP_EOL . PHP_EOL;
- }
- }
-
- if ( is_string($this->settings['confirmMailSubscribeInstruction']) && strlen(trim($this->settings['confirmMailSubscribeInstruction'])) > 0 ) {
- $bodySubscribeLink = $this->settings['confirmMailSubscribeInstruction'];
- $bodySubscribeLink .= PHP_EOL . $subscribeLink . PHP_EOL . PHP_EOL;
- }
-
- if ( is_string($this->settings['confirmMailUnsubscribeInstruction']) && strlen(trim($this->settings['confirmMailUnsubscribeInstruction'])) > 0 ) {
- $bodyUnsubscribeLink = $this->settings['confirmMailUnsubscribeInstruction'];
- $bodyUnsubscribeLink .= PHP_EOL . $unsubscribeLink . PHP_EOL . PHP_EOL;
- }
-
- if ( is_string($this->settings['confirmMailFooter']) && strlen(trim($this->settings['confirmMailFooter'])) > 0 ) {
- $bodyFooter = PHP_EOL . PHP_EOL . $this->settings['confirmMailFooter'];
- }
- // Remove subscribe link part of message if it is a unsubscribe mail.
- if ($unsubscribeMail) {
- $bodySubscribeLink = '';
- }
-
- return $bodyText . $bodySubscribeLink . $bodyUnsubscribeLink . $bodyFooter;
-
- }
-
- /**
- * Get request argument
- *
- * @var string $argument Name of argument
- * @return string
- */
- protected function getArgument($argument) {
-
- $return = '';
- if ( $this->request->hasArgument($argument) ) {
- $return = GeneralUtility::removeXSS( $this->request->getArgument($argument) );
- }
- return $return;
+ protected function getFeLink($id, $status)
+ {
+ $confirmPageId = intval($this->settings['confirmPage']) ?
+ intval($this->settings['confirmPage']) : $GLOBALS['TSFE']->id;
+
+ $linkParams = [
+ 'status' => $status,
+ 'hashid' => $id,
+ 'hash' => $this->hashService->generateHmac('pxa_newsletter_subscription-' . $status . $id)
+ ];
+
+
+ return $this
+ ->uriBuilder
+ ->reset()
+ ->setTargetPageUid($confirmPageId)
+ ->setCreateAbsoluteUri(true)
+ ->uriFor('confirm', $linkParams);
}
/**
@@ -685,68 +386,8 @@ protected function getArgument($argument) {
* @var string $name Name
* @return bool
*/
- protected function isNameValid($name) {
- $isValid = FALSE;
- if ( $this->settings['formFieldNameIsMandatory'] == 0 ) {
- $isValid = TRUE;
- } else {
- if ( is_string($name) && strlen(trim($name)) > 0 ) {
- $isValid = TRUE;
- }
- }
- return $isValid;
- }
-
- /**
- * Check if name field should be hidden in form
- *
- * @return bool
- */
- protected function isNameVisibleInForm() {
- $isVisible = true;
- if ( $this->settings['formFieldNameIsMandatory'] == 0 ) {
- if ( $this->settings['formFieldNameHidden'] == 1 ) {
- $isVisible = false;
- }
- }
- return $isVisible;
- }
-
- /**
- * Fetches content from file
- *
- * @param string $filename
- * @return string FileContent
- */
- public function getFileContent($filename) {
-
- $dynamicJavascript = '';
-
- if ( $this->isFileAccessible($filename) ) {
- $absoluteFilename = GeneralUtility::getFileAbsFileName($filename);
- $dynamicJavascript = GeneralUtility::getUrl($absoluteFilename);
- }
-
- return $dynamicJavascript;
- }
-
- /**
- * Check if file is accessible
- *
- * @param string $filename Relative path to file, EXT: works.
- * @return bool
- */
- public function isFileAccessible($filename) {
-
- $isFileAccessible = false;
-
- $absoluteFilename = GeneralUtility::getFileAbsFileName($filename);
- if (GeneralUtility::isAllowedAbsPath($absoluteFilename)) {
- if ( \file_exists($absoluteFilename) ) {
- $isFileAccessible = true;
- }
- }
-
- return $isFileAccessible;
+ protected function isNameValid($name)
+ {
+ return !$this->settings['formFieldNameIsMandatory'] || !empty($name);
}
}
diff --git a/Classes/Domain/Model/FrontendUser.php b/Classes/Domain/Model/FrontendUser.php
index 5357565..5ef8406 100644
--- a/Classes/Domain/Model/FrontendUser.php
+++ b/Classes/Domain/Model/FrontendUser.php
@@ -35,105 +35,69 @@
*
*/
-class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser {
-
- /**
- * @var boolean
- */
- protected $disable;
-
- /**
- * @var boolean
- */
- protected $deleted;
-
- /**
- * @param boolean $disable
- */
- public function setDisable($disable) {
- $this->disable = $disable;
- }
-
- /**
- * @return boolean
- */
- public function getDisable() {
- return $this->disable;
- }
-
- /**
- * @param boolean $deleted
- */
- public function setDeleted($deleted) {
- $this->deleted = $deleted;
- }
-
- /**
- * @return boolean
- */
- public function getDeleted() {
- return $this->deleted;
- }
-
- /**
- * Sets password with a random generated password.
- *
- * @param int $length The length of the password.
- * @return void
- */
- public function setRandomPassword($length = 12) {
-
- $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
- $password = substr( str_shuffle( $chars ), 0, $length );
-
- $this->password = $password;
-
- }
-
- /**
- * Sets random hash (uses fax property).
- *
- * @return void
- */
- public function setHash()
- {
- $randomHash = substr(md5(uniqid(rand(), true)), 16, 16);
- $this->fax = $randomHash;
- }
-
- /**
- * Gets random hash (uses fax property).
- *
- * @return string
- */
- public function getHash()
- {
- return $this->fax;
- }
-
- /**
- * Creates a new Frontend User as a subscriber.
- *
- * @param int $pid The page to store the Frontend User on.
- * @param string $email The email of the user.
- * @param string $name The name of the user.
- * @param bool $confirm If the user needs to confirm subscription by email.
- * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup $usergroup The usergroup user should be a member of.
- * @return void
- */
- public function setAsSubscriber($pid, $email, $name, $confirm, \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup $usergroup) {
-
- $this->setPid(intval($pid));
- $this->setUsername($email);
- $this->setEmail($email);
- $this->setName($name);
- $this->setDisable(intval($confirm));
- $this->setHash();
- $this->setRandomPassword(12);
- $this->addUsergroup($usergroup);
-
- }
-
-
+class FrontendUser extends \TYPO3\CMS\Extbase\Domain\Model\FrontendUser
+{
+
+ /**
+ * @var boolean
+ */
+ protected $disable;
+
+ /**
+ * @param boolean $disable
+ */
+ public function setDisable($disable)
+ {
+ $this->disable = $disable;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function getDisable()
+ {
+ return $this->disable;
+ }
+
+ /**
+ * Sets password with a random generated password.
+ *
+ * @param int $length The length of the password.
+ * @return void
+ */
+ public function setRandomPassword($length = 12)
+ {
+
+ $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
+ $password = substr(str_shuffle($chars), 0, $length);
+
+ $this->password = $password;
+ }
+
+ /**
+ * Creates a new Frontend User as a subscriber.
+ *
+ * @param int $pid The page to store the Frontend User on.
+ * @param string $email The email of the user.
+ * @param string $name The name of the user.
+ * @param bool $confirm If the user needs to confirm subscription by email.
+ * @param \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup $usergroup The usergroup user should be a member of.
+ * @return void
+ */
+ public function setAsSubscriber(
+ $pid,
+ $email,
+ $name,
+ $confirm,
+ \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup $usergroup
+ ) {
+
+ $this->setPid(intval($pid));
+ $this->setUsername($email);
+ $this->setEmail($email);
+ $this->setName($name);
+ $this->setDisable(intval($confirm));
+ $this->setRandomPassword(12);
+ $this->addUsergroup($usergroup);
+ }
}
-?>
\ No newline at end of file
diff --git a/Classes/Domain/Model/FrontendUserGroup.php b/Classes/Domain/Model/FrontendUserGroup.php
index 457ed71..1c5bece 100644
--- a/Classes/Domain/Model/FrontendUserGroup.php
+++ b/Classes/Domain/Model/FrontendUserGroup.php
@@ -1,4 +1,5 @@
createQuery();
- $query = $this->createQuery();
-
- $query->getQuerySettings()->setRespectStoragePage(FALSE);
-
- $frontendUserGroup = $query
- ->matching(
- $query->equals('uid',$uid)
- )
- ->execute()
- ->getFirst();
-
- return $frontendUserGroup;
- }
+ $query->getQuerySettings()->setRespectStoragePage(false);
+ return $query
+ ->matching(
+ $query->equals('uid', $uid)
+ )
+ ->execute()
+ ->getFirst();
+ }
}
-?>
diff --git a/Classes/Domain/Repository/FrontendUserRepository.php b/Classes/Domain/Repository/FrontendUserRepository.php
index 86dbcc3..be873ad 100644
--- a/Classes/Domain/Repository/FrontendUserRepository.php
+++ b/Classes/Domain/Repository/FrontendUserRepository.php
@@ -1,4 +1,5 @@
createQuery();
-
- $query->getQuerySettings()->setRespectStoragePage(FALSE);
- $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
- $query->getQuerySettings()->setEnableFieldsToBeIgnored(array('disabled'));
-
- $countUsers = $query
- ->matching(
- $query->logicalAnd(
- $query->equals('email', $email),
- $query->equals('pid', $pid)
- )
- )
- ->count();
-
- return $countUsers;
- }
-
- /**
- * Does frontend user with email exist on page with pid.
- *
- * @param string $email
- * @param int $pid
- * @return bool
- */
- public function doesEmailExistInPid($email, $pid) {
-
- $query = $this->createQuery();
-
- $query->getQuerySettings()->setRespectStoragePage(FALSE);
- $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
- $query->getQuerySettings()->setEnableFieldsToBeIgnored(array('disabled'));
-
- $countUsers = $query
- ->matching(
- $query->logicalAnd(
- $query->equals('email', $email),
- $query->equals('pid', $pid)
- )
- )
- ->count();
-
- return $countUsers > 0;
- }
-
- /**
- * Gets a Frontend User by uid and hash (fax)
- *
- * @param int $uid
- * @param string $hash
- * @return Pixelant\PxaNewsletterSubscription\Domain\Model\FrontendUser
- */
- public function getUserByUidAndHash($uid, $hash) {
-
- $query = $this->createQuery();
-
- $query->getQuerySettings()->setRespectStoragePage(FALSE);
- $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
- $query->getQuerySettings()->setEnableFieldsToBeIgnored(array('disabled'));
-
- $frontendUser = $query
- ->matching(
- $query->logicalAnd(
- $query->equals('uid', $uid),
- $query->equals('fax', $hash)
- )
- )
- ->execute()
- ->getFirst();
-
- return $frontendUser;
- }
-
- /**
- * Gets a sigle (first) Frontend User by email and pid
- *
- * @param string $email
- * @param int $pid
- * @return Pixelant\PxaNewsletterSubscription\Domain\Model\FrontendUser
- */
- public function getUserByEmailAndPid($email, $pid) {
-
- $query = $this->createQuery();
-
- $query->getQuerySettings()->setRespectStoragePage(FALSE);
- $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
- $query->getQuerySettings()->setEnableFieldsToBeIgnored(array('disabled'));
-
- $frontendUser = $query
- ->matching(
- $query->logicalAnd(
- $query->equals('email', $email),
- $query->equals('pid', $pid)
- )
- )
- ->execute()
- ->getFirst();
-
- return $frontendUser;
- }
-
+class FrontendUserRepository extends \TYPO3\CMS\Extbase\Domain\Repository\FrontendUserRepository
+{
+
+ /**
+ * initialize default settings
+ */
+ public function initializeObject()
+ {
+ /** @var Typo3QuerySettings $defaultQuerySettings */
+ $defaultQuerySettings = $this->objectManager->get(Typo3QuerySettings::class);
+
+ $defaultQuerySettings->setRespectStoragePage(false);
+ $defaultQuerySettings->setIgnoreEnableFields(true);
+ $defaultQuerySettings->setEnableFieldsToBeIgnored(['disabled']);
+
+ $this->setDefaultQuerySettings($defaultQuerySettings);
+ }
+
+ /**
+ * Find one user
+ *
+ * @param int $uid
+ * @return object
+ */
+ public function findByUid($uid)
+ {
+ $query = $this->createQuery();
+ return $query->matching($query->equals('uid', $uid))->execute()->getFirst();
+ }
+
+ /**
+ * Does frontend user with email exist on page with pid.
+ *
+ * @param string $email
+ * @param int $pid
+ * @return bool
+ */
+ public function doesEmailExistInPid($email, $pid)
+ {
+ $query = $this->createQuery();
+
+ $countUsers = $query
+ ->matching(
+ $query->logicalAnd(
+ $query->equals('email', $email),
+ $query->equals('pid', $pid)
+ )
+ )
+ ->count();
+
+ return $countUsers > 0;
+ }
+
+ /**
+ * Gets a sigle (first) Frontend User by email and pid
+ *
+ * @param string $email
+ * @param int $pid
+ * @return \Pixelant\PxaNewsletterSubscription\Domain\Model\FrontendUser|object
+ */
+ public function getUserByEmailAndPid($email, $pid)
+ {
+
+ $query = $this->createQuery();
+
+ $frontendUser = $query
+ ->matching(
+ $query->logicalAnd(
+ $query->equals('email', $email),
+ $query->equals('pid', $pid)
+ )
+ )
+ ->execute()
+ ->getFirst();
+
+ return $frontendUser;
+ }
}
-?>
diff --git a/Classes/Service/EmailNotificationService.php b/Classes/Service/EmailNotificationService.php
new file mode 100644
index 0000000..cd6d583
--- /dev/null
+++ b/Classes/Service/EmailNotificationService.php
@@ -0,0 +1,170 @@
+mailMessage = GeneralUtility::makeInstance(MailMessage::class);
+
+ // plugin settings
+ $this->settings = $settings;
+ }
+
+ /**
+ * Send email
+ *
+ * @param FrontendUser $feUser
+ * @param string $link
+ * @param bool $unSubscribeMail
+ * @return void
+ */
+ public function sendConfirmationEmail(FrontendUser $feUser, $link, $unSubscribeMail)
+ {
+ $link = $this->generateLink($link);
+
+ $this->mailMessage->setFrom($this->getSender());
+ $this->mailMessage->setTo($feUser->getEmail());
+ $this->mailMessage->setSubject($this->getConfirmMailSubject());
+ $this->mailMessage->setBody(
+ $this->getConfirmMailBody($feUser, $link, $unSubscribeMail),
+ 'text/html'
+ );
+
+ $this->mailMessage->send();
+ }
+
+ /**
+ * Get sender name and email
+ *
+ * @return array
+ */
+ protected function getSender()
+ {
+ // Override with flexform settings if set and valid
+ if (!empty($this->settings['confirmMailSenderName'])) {
+ $confirmMailSenderName = $this->settings['confirmMailSenderName'];
+ } else {
+ $confirmMailSenderName = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'];
+ }
+
+ if (GeneralUtility::validEmail($this->settings['confirmMailSenderEmail'])) {
+ $confirmMailSenderEmail = $this->settings['confirmMailSenderEmail'];
+ } else {
+ $confirmMailSenderEmail = $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'];
+ }
+
+ // If from email is still empty, use a no-reply address
+ if (empty($confirmMailSenderEmail)) {
+ // Won't work on all domains!
+ $domain = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');
+ if (substr($domain, 0, 3) == 'www') {
+ $domain = substr($domain, 4);
+ }
+
+ $confirmMailSenderEmail = 'no-reply@' . $domain;
+ }
+
+ if (empty($confirmMailSenderName)) {
+ $confirmMailSenderName = $confirmMailSenderEmail;
+ }
+
+ return [$confirmMailSenderEmail => $confirmMailSenderName];
+ }
+
+ /**
+ * Generates the Body string for confirmation mail
+ *
+ * @param FrontendUser $feUser
+ * @param $link
+ * @param $unSubscribeMail
+ * @return string
+ */
+ protected function getConfirmMailBody(FrontendUser $feUser, $link, $unSubscribeMail)
+ {
+ // Check flex form value
+ $bodyText = $unSubscribeMail ?
+ $this->settings['confirmMailUnsubscribeBody'] : $this->settings['confirmMailSubscribeBody'];
+
+ if (empty($bodyText)) {
+ // Set defaults from original translation, has replacement in texts
+ $bodyText = LocalizationUtility::translate(
+ 'confirm_mail_greeting',
+ 'pxa_newsletter_subscription',
+ [$feUser->getName()]
+ );
+ }
+
+ if (strpos($bodyText, self::LINK_HOLDER) !== false) {
+ $bodyText = str_replace(self::LINK_HOLDER, $link, $bodyText);
+ } else {
+ // append
+ $bodyText .= sprintf(
+ '%s
',
+ $link
+ );
+ }
+
+ return $bodyText;
+ }
+
+ /**
+ * If link text is set, generate HTML for link
+ *
+ * @param string $link
+ * @return string
+ */
+ protected function generateLink($link)
+ {
+ if (!empty($this->settings['confirmLinkText'])) {
+ $link = sprintf(
+ '%s',
+ $link,
+ $this->settings['confirmLinkText']
+ );
+ }
+
+ return $link;
+ }
+
+ /**
+ * Generates the Subject for confirmation mail
+ *
+ * @return string
+ */
+ protected function getConfirmMailSubject()
+ {
+ return empty($this->settings['confirmMailSubject']) ?
+ LocalizationUtility::translate('confirm_mail_subject', 'pxa_newsletter_subscription') :
+ $this->settings['confirmMailSubject'];
+ }
+}
diff --git a/Classes/ViewHelpers/WrapContentViewHelper.php b/Classes/ViewHelpers/WrapContentViewHelper.php
new file mode 100644
index 0000000..5819228
--- /dev/null
+++ b/Classes/ViewHelpers/WrapContentViewHelper.php
@@ -0,0 +1,62 @@
+registerArgument('settings', 'array', 'Settings', true);
+ }
+
+ /**
+ * Wrap with special classes
+ *
+ * @return string
+ */
+ public function render()
+ {
+ return $this->wrap(
+ 'outerWrap',
+ $this->wrap(
+ 'innerWrap',
+ $this->renderChildren()
+ )
+ );
+ }
+
+ /**
+ * Wrap
+ *
+ * @param $wrapType
+ * @param $content
+ * @return string
+ */
+ protected function wrap($wrapType, $content)
+ {
+ if (is_array($this->arguments['settings'][$wrapType])) {
+ if ((int)$this->arguments['settings'][$wrapType]['enabled'] === 1) {
+ return sprintf(
+ '%s
',
+ $this->arguments['settings'][$wrapType]['class'],
+ $content
+ );
+ }
+ }
+
+ return $content;
+ }
+}
diff --git a/Configuration/FlexForms/flexform_pi1.xml b/Configuration/FlexForms/flexform_pi1.xml
index 451f846..bda766e 100644
--- a/Configuration/FlexForms/flexform_pi1.xml
+++ b/Configuration/FlexForms/flexform_pi1.xml
@@ -1,250 +1,180 @@
-
- 1
-
-
-
-
-
-
- Settings
-
-
- array
-
-
-
-
-
- check
-
- reload
-
-
-
-
-
-
- check
-
- reload
-
-
-
-
-
- FIELD:settings.formFieldNameIsMandatory:=:0
-
- check
-
-
-
-
-
-
-
- check
-
-
-
-
-
-
-
- check
-
-
-
-
-
- 1
-
-
- group
- db
- pages
- 1
- 1
- 1
- 1
-
-
- suggest
-
-
-
-
-
-
-
- 1
-
-
- group
- db
- fe_groups
- 1
- 1
- 1
-
-
-
-
-
- 1
-
-
- group
- db
- pages
- 1
- 1
- 0
- 1
-
-
- suggest
-
-
-
-
-
-
-
-
-
-
-
-
- Confirmation Mail
-
-
-
- array
-
-
-
-
-
- input
- 20
- 30
-
-
-
-
-
-
-
-
- input
- 20
- 30
- trim
-
-
-
-
-
-
-
- input
- 20
- 30
- trim
-
-
-
-
-
-
-
- input
- 35
- 35
-
-
-
-
-
-
-
- text
- 35
- 10
-
-
-
-
-
-
-
- text
- 35
- 10
-
-
-
-
-
-
-
- text
- 35
- 2
-
-
-
-
-
-
-
- text
- 35
- 2
-
-
-
-
-
-
-
- text
- 35
- 3
-
-
-
-
-
-
-
+
+ 1
+
+
+
+
+
+
+ Settings
+
+
+ array
+
+
+
+
+ reload
+
+ check
+
+
+
+
+
+
+
+ check
+
+
+
+
+
+
+
+ check
+
+
+
+
+
+ 1
+
+
+ group
+ db
+ pages
+ 1
+ 1
+ 1
+ 1
+
+
+ suggest
+
+
+
+
+
+
+
+ 1
+
+
+ group
+ db
+ fe_groups
+ 1
+ 1
+ 1
+
+
+
+
+
+ 1
+
+ FIELD:settings.enableEmailConfirm:REQ:TRUE
+
+ group
+ db
+ pages
+ 1
+ 1
+ 0
+ 1
+
+
+ suggest
+
+
+
+
+
+
+
+
+
+
+
+ Confirmation Mail
+
+ FIELD:sDEF.settings.enableEmailConfirm:REQ:TRUE
+ array
+
+
+
+
+
+ input
+ 20
+ 30
+ trim,required
+
+
+
+
+
+
+
+ input
+ 20
+ 30
+ trim,required
+
+
+
+
+
+
+
+ input
+ 35
+ 35
+ trim,required
+
+
+
+
+
+
+
+ input
+ 35
+ 35
+ trim
+
+
+
+
+
+
+ richtext[*]:rte_transform[mode=ts_css]
+
+ text
+ 35
+ 10
+ trim,required
+ 1
+
+
+
+
+
+
+ richtext[*]:rte_transform[mode=ts_css]
+
+ text
+ 35
+ 10
+ trim,required
+ 1
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/fe_users.php b/Configuration/TCA/Overrides/fe_users.php
new file mode 100644
index 0000000..a0af096
--- /dev/null
+++ b/Configuration/TCA/Overrides/fe_users.php
@@ -0,0 +1,10 @@
+ 1,
+ 'config' => [
+ 'type' => 'passthrough'
+ ]
+];
diff --git a/Configuration/TCA/Overrides/sys_template.php b/Configuration/TCA/Overrides/sys_template.php
new file mode 100644
index 0000000..fc9ca7d
--- /dev/null
+++ b/Configuration/TCA/Overrides/sys_template.php
@@ -0,0 +1,8 @@
+
Name is mandatory for subscribe
-
- Exclude name in the subscribe form
-
- Save to folder
+ Storage
Select a usergroup
-
- Force form view (Usable f.ex. when you have a subscribe in the footer)
-
Display unsubscribe button
- Confirmation page (if none is selected the ajax action is used, the page will only contain the confirm message)
+ Confirmation page (if none is selected current page will be used)
Sender name in confirm mail
@@ -33,26 +27,17 @@
Sender e-mail in confirm mail
-
- Reply to address in confirm mail
-
Subject of confirmation mail
- Body of subscribe confirmation mail
+ Body of subscribe confirmation mail. Use "{link}" to add confirmation link.
- Body of unsubscribe confirmation mail
-
-
- Subscribe instruction in confirmation mail (displayed above subscribelink)
-
-
- Unsubscribe instruction in confirmation mail (displayed above unsubscribelink)
+ Body of unsubscribe confirmation mail. Use "{link}" to add confirmation link.
-
-
-
diff --git a/Resources/Private/Layouts/Standalone.html b/Resources/Private/Layouts/Standalone.html
deleted file mode 100644
index c90cd90..0000000
--- a/Resources/Private/Layouts/Standalone.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-