mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
unsubscribe
This commit is contained in:
parent
f38b017d85
commit
259b9f33a5
5 changed files with 34 additions and 1 deletions
|
@ -101,6 +101,7 @@ class Controller
|
||||||
$router->any('/list/subscribe', 'MailActions::executeSubscribe');
|
$router->any('/list/subscribe', 'MailActions::executeSubscribe');
|
||||||
$router->any('/list/subscribed', 'MailActions::executeSubscribed');
|
$router->any('/list/subscribed', 'MailActions::executeSubscribed');
|
||||||
$router->get('/list/confirm/{hash}', 'MailActions::executeConfirm');
|
$router->get('/list/confirm/{hash}', 'MailActions::executeConfirm');
|
||||||
|
$router->get('/list/unsubscribe/{email}', 'MailActions::executeUnsubscribe');
|
||||||
|
|
||||||
$router->any('/dmca', 'ReportActions::executeDmca');
|
$router->any('/dmca', 'ReportActions::executeDmca');
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ class MailActions extends Actions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static function prepareSubscribeFormPartial(array $vars)
|
public static function prepareSubscribeFormPartial(array $vars)
|
||||||
{
|
{
|
||||||
$vars += ['btnClass' => 'btn-primary', 'returnUrl' => Request::getRelativeUri()];
|
$vars += ['btnClass' => 'btn-primary', 'returnUrl' => Request::getRelativeUri()];
|
||||||
|
@ -70,4 +69,16 @@ class MailActions extends Actions
|
||||||
|
|
||||||
return $vars;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function executeUnsubscribe(string $email)
|
||||||
|
{
|
||||||
|
$decodedEmail = Encoding::base64DecodeUrlsafe($email);
|
||||||
|
if (!$decodedEmail)
|
||||||
|
{
|
||||||
|
return ['mail/unsubscribe', ['error' => 'Invalid unsubscribe link']];
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = LBRY::unsubscribe($decodedEmail);
|
||||||
|
return ['mail/unsubscribe', ['error' => $response['error']]];
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -58,6 +58,7 @@ email:
|
||||||
confirm_email_button: Confirm Subscription
|
confirm_email_button: Confirm Subscription
|
||||||
confirm_email_subject: Confirm Your Subscription to LBRY
|
confirm_email_subject: Confirm Your Subscription to LBRY
|
||||||
confirm_success: Great success! Welcome to LBRY.
|
confirm_success: Great success! Welcome to LBRY.
|
||||||
|
confirm_unsubscribe: You are unsubscribed.
|
||||||
disclaimer: You will receive 1-2 messages a month, only from LBRY Inc. and only about LBRY. You can easily unsubscribe at any time.
|
disclaimer: You will receive 1-2 messages a month, only from LBRY Inc. and only about LBRY. You can easily unsubscribe at any time.
|
||||||
go: Go
|
go: Go
|
||||||
invalid_confirm_hash: This link is expired or invalid. Please enter your email address again.
|
invalid_confirm_hash: This link is expired or invalid. Please enter your email address again.
|
||||||
|
@ -112,6 +113,7 @@ page:
|
||||||
header: Frequently Asked Questions
|
header: Frequently Asked Questions
|
||||||
funnier: One day this will be funnier but today is not that day.
|
funnier: One day this will be funnier but today is not that day.
|
||||||
join: Join Email List
|
join: Join Email List
|
||||||
|
unsubscribe: Unsubscribe
|
||||||
refer:
|
refer:
|
||||||
count0: Don't fret, we still like you.
|
count0: Don't fret, we still like you.
|
||||||
count1: Great start! Thanks for sharing.
|
count1: Great start! Thanks for sharing.
|
||||||
|
@ -243,6 +245,7 @@ social:
|
||||||
title:
|
title:
|
||||||
home: LBRY - Content Freedom
|
home: LBRY - Content Freedom
|
||||||
join: Join LBRY Email List
|
join: Join LBRY Email List
|
||||||
|
unsubscribe: Unsubscribe
|
||||||
learn: Learn About LBRY
|
learn: Learn About LBRY
|
||||||
publish: Publish
|
publish: Publish
|
||||||
refer: Share and Earn
|
refer: Share and Earn
|
||||||
|
|
5
lib/thirdparty/LBRY.class.php
vendored
5
lib/thirdparty/LBRY.class.php
vendored
|
@ -16,4 +16,9 @@ class LBRY
|
||||||
]);
|
]);
|
||||||
return $response['data']['lbc_usd'] ?? 0;
|
return $response['data']['lbc_usd'] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function unsubscribe($email)
|
||||||
|
{
|
||||||
|
return Curl::post(static::getApiUrl('/user_unsubscribe/new'), ['email' => $email], ['json_response' => true]);
|
||||||
|
}
|
||||||
}
|
}
|
13
view/template/mail/unsubscribe.php
Normal file
13
view/template/mail/unsubscribe.php
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?php Response::setMetaTitle(__('title.unsubscribe')) ?>
|
||||||
|
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
|
||||||
|
<main>
|
||||||
|
<div class="content">
|
||||||
|
<h1>{{page.unsubscribe}}</h1>
|
||||||
|
<?php if ($error ?? false): ?>
|
||||||
|
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="notice notice-success spacer1">{{email.confirm_unsubscribe}}</div>
|
||||||
|
<?php endif ?>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
<?php echo View::render('nav/_footer', ['showLearnFooter' => $learnFooter ?? false]) ?>
|
Loading…
Add table
Reference in a new issue