mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
Add multiple url redirect with session
This commit is contained in:
parent
c0344be7a2
commit
d2e80b462c
2 changed files with 23 additions and 13 deletions
|
@ -10,7 +10,8 @@ class Session
|
|||
KEY_DEVELOPER_RETURN_URL_SUCCESS = 'developer_return_url_success',
|
||||
KEY_GITHUB_ACCESS_TOKEN = 'github_access_token',
|
||||
KEY_LIST_SUB_ERROR = 'list_error',
|
||||
KEY_USER_CULTURE = 'user_culture';
|
||||
KEY_USER_CULTURE = 'user_culture',
|
||||
KEY_YOUTUBE_TEMPLATE = 'youtube_landing_template';
|
||||
|
||||
const NAMESPACE_DEFAULT = 'default',
|
||||
NAMESPACE_FLASH = 'flash',
|
||||
|
|
|
@ -24,6 +24,8 @@ class AcquisitionActions extends Actions
|
|||
Mailgun::sendYouTubeWarmLead(['email' => $email]);
|
||||
|
||||
Session::setFlash('success', 'Thanks! We\'ll be in touch. The good kind of touch.');
|
||||
|
||||
return Controller::redirect(Request::getReferrer(), 303);
|
||||
}
|
||||
|
||||
public static function executeYouTube(string $version = '')
|
||||
|
@ -36,8 +38,15 @@ class AcquisitionActions extends Actions
|
|||
$versionedTemplate = $baseTemplate . '-' . $version;
|
||||
$template = $version && View::exists($versionedTemplate) ? $versionedTemplate : $baseTemplate;
|
||||
|
||||
//since multiple URLs come into this page, we need to save the URL the user came in with and send them back to it
|
||||
//in addition to storing here, all redirections to /youtube need to be updated to send back to the URL we capture here
|
||||
if ($version && View::exists($versionedTemplate)) {
|
||||
Session::set(SESSION::KEY_YOUTUBE_TEMPLATE, $template);
|
||||
}
|
||||
|
||||
$template = Session::get(SESSION::KEY_YOUTUBE_TEMPLATE) ?? $template;
|
||||
if (!View::exists($template)) {
|
||||
Session::unsetKey(SESSION::KEY_YOUTUBE_TEMPLATE);
|
||||
$template = $baseTemplate;
|
||||
}
|
||||
|
||||
return [$template, [
|
||||
'reward' => LBRY::youtubeReward(),
|
||||
|
|
Loading…
Add table
Reference in a new issue