diff --git a/controller/Session.class.php b/controller/Session.class.php index e91cd460..1dafef9d 100644 --- a/controller/Session.class.php +++ b/controller/Session.class.php @@ -8,7 +8,10 @@ class Session { const KEY_MAILCHIMP_LIST_IDS = 'mailchimp_list_ids', - KEY_LIST_SUB_SUCCESS = 'list_success'; + KEY_LIST_SUB_ERROR = 'list_error', + KEY_LIST_SUB_SIGNATURE = 'list_sub_sig', + KEY_LIST_SUB_SUCCESS = 'list_success', + KEY_LIST_SUB_FB_EVENT = 'list_sub_fb_event'; public static function init() { diff --git a/controller/action/ContentActions.class.php b/controller/action/ContentActions.class.php index 7706f2b2..b3151aea 100644 --- a/controller/action/ContentActions.class.php +++ b/controller/action/ContentActions.class.php @@ -17,6 +17,10 @@ class ContentActions extends Actions public static function executeGet() { + if (isset($_GET['email']) && $_GET['email'] && Session::get(Session::KEY_LIST_SUB_ERROR)) + { + Controller::redirect('/get'); + } return ['page/get', [ 'isSubscribed' => $_GET['email'] || in_array(Mailchimp::LIST_GENERAL_ID, Session::get(Session::KEY_MAILCHIMP_LIST_IDS, [])) ]]; diff --git a/controller/action/MailActions.class.php b/controller/action/MailActions.class.php index 67d8bf7d..3d8c0c70 100644 --- a/controller/action/MailActions.class.php +++ b/controller/action/MailActions.class.php @@ -15,6 +15,8 @@ class MailActions extends Actions { Controller::redirect($nextUrl); } + + Session::set(Session::KEY_LIST_SUB_SIGNATURE, isset($_POST['listSig']) ? $_POST['listSig'] : true); $email = $_POST['email']; if (!$email|| !filter_var($email, FILTER_VALIDATE_EMAIL)) @@ -34,7 +36,8 @@ class MailActions extends Actions if ($success) { Session::set(Session::KEY_MAILCHIMP_LIST_IDS, array_merge(Session::get(Session::KEY_MAILCHIMP_LIST_IDS, []), [$mcListId])); - Session::set(Session::KEY_LIST_SUB_SUCCESS, __('Great success! Welcome to LBRY.')); + Session::set(Session::KEY_LIST_SUB_SUCCESS, true); + Session::set(Session::KEY_LIST_SUB_FB_EVENT, isset($_POST['fbEvent']) ? $_POST['fbEvent'] : null); } else { @@ -48,11 +51,24 @@ class MailActions extends Actions public static function prepareJoinList(array $vars) { + $vars['listSig'] = md5(serialize($vars)); $vars += ['btnClass' => 'btn-primary', 'returnUrl' => $_SERVER['REQUEST_URI']]; - $vars['error'] = Session::get('list_error'); - $vars['success'] = Session::get(Session::KEY_LIST_SUB_SUCCESS); - Session::unsetKey('list_error'); - Session::unsetKey(Session::KEY_LIST_SUB_SUCCESS); + + if (Session::get(Session::KEY_LIST_SUB_SIGNATURE) == $vars['listSig']) + { + $vars['error'] = Session::get('list_error'); + Session::unsetKey('list_error'); + + $vars['success'] = Session::get(Session::KEY_LIST_SUB_SUCCESS) ? __('Great success! Welcome to LBRY.') : false; + $vars['fbEvent'] = Session::get(Session::KEY_LIST_SUB_FB_EVENT) ?: 'Lead'; + Session::unsetKey(Session::KEY_LIST_SUB_SUCCESS); + Session::unsetKey(Session::KEY_LIST_SUB_FB_EVENT); + } + else + { + $vars['success'] = false; + } + return $vars; } diff --git a/view/mail/joinList.php b/view/mail/joinList.php index 13d40db5..27b68b47 100644 --- a/view/mail/joinList.php +++ b/view/mail/joinList.php @@ -5,23 +5,29 @@ ga('send', 'event', 'Sign Up', 'Join List', ''); twttr.conversion.trackPid('nty1x'); - fbq('track', "Lead"); + fbq('track', );
-Earn early adopter rewards and interact directly with developers via our Alpha client.
+