fix referral credits session bug

This commit is contained in:
Jeremy Kauffman 2016-08-04 13:06:46 -04:00
parent fde7975f73
commit 2a70635d48
2 changed files with 12 additions and 14 deletions

View file

@ -23,26 +23,29 @@ class DownloadActions extends Actions
{ {
$email = static::param('e'); $email = static::param('e');
$user = []; $user = [];
if ($email) if ($email)
{ {
$emailIsValid = filter_var($email, FILTER_VALIDATE_EMAIL); if (filter_var($email, FILTER_VALIDATE_EMAIL))
if ($emailIsValid)
{ {
$user = Prefinery::findUser($email); $user = Prefinery::findUser($email);
if ($user)
{
static::setSessionVarsForPrefineryUser($user);
}
} }
if (!$emailIsValid || !$user) if (!$user)
{ {
Session::unsetKey(Session::KEY_PREFINERY_USER_ID); Session::unsetKey(Session::KEY_PREFINERY_USER_ID);
Session::unsetKey(Session::KEY_DOWNLOAD_ALLOWED); Session::unsetKey(Session::KEY_DOWNLOAD_ALLOWED);
} }
} }
elseif (Session::get(Session::KEY_PREFINERY_USER_ID))
{
$user = Prefinery::findUser(Session::get(Session::KEY_PREFINERY_USER_ID));
}
if ($user)
{
static::setSessionVarsForPrefineryUser($user);
}
if (!Session::get(Session::KEY_DOWNLOAD_ALLOWED)) if (!Session::get(Session::KEY_DOWNLOAD_ALLOWED))
{ {

View file

@ -10,11 +10,6 @@
<?php echo View::render('download/_betaNotice') ?> <?php echo View::render('download/_betaNotice') ?>
<h4>{{download.verb}}</h4> <h4>{{download.verb}}</h4>
<?php echo $downloadHtml ?> <?php echo $downloadHtml ?>
<h4>{{download.credits}}</h4>
<?php if ($prefineryUser): ?>
<p>{{download.email1}}<strong><?php echo $prefineryUser['email'] ?></strong>{{download.email2}}</p>
<div class="meta">{{download.email3}}</div>
<?php endif ?>
<?php else: ?> <?php else: ?>
<?php echo View::render('download/_unavailable', [ <?php echo View::render('download/_unavailable', [
'os' => $os 'os' => $os