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');
$user = [];
if ($email)
{
$emailIsValid = filter_var($email, FILTER_VALIDATE_EMAIL);
if ($emailIsValid)
if (filter_var($email, FILTER_VALIDATE_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_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))
{

View file

@ -10,11 +10,6 @@
<?php echo View::render('download/_betaNotice') ?>
<h4>{{download.verb}}</h4>
<?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 echo View::render('download/_unavailable', [
'os' => $os