Change subscription
A new subscription can only be set if your email address is confirmed.
This commit is contained in:
parent
a401ce4d83
commit
0b4a3331c6
3 changed files with 27 additions and 0 deletions
|
@ -5,6 +5,7 @@ namespace ForkBB\Models\Pages;
|
|||
use ForkBB\Models\Page;
|
||||
use ForkBB\Models\Forum\Model as Forum;
|
||||
use ForkBB\Models\Topic\Model as Topic;
|
||||
use function \ForkBB\__;
|
||||
|
||||
class Misc extends Page
|
||||
{
|
||||
|
@ -52,6 +53,10 @@ class Misc extends Page
|
|||
$this->c->Lang->load('misc');
|
||||
|
||||
if ('subscribe' === $args['type']) {
|
||||
if (! $this->user->email_confirmed) {
|
||||
return $this->confirmMessage();
|
||||
}
|
||||
|
||||
$this->c->subscriptions->subscribe($this->user, $forum);
|
||||
|
||||
$message = 'Subscribe redirect';
|
||||
|
@ -81,6 +86,10 @@ class Misc extends Page
|
|||
$this->c->Lang->load('misc');
|
||||
|
||||
if ('subscribe' === $args['type']) {
|
||||
if (! $this->user->email_confirmed) {
|
||||
return $this->confirmMessage();
|
||||
}
|
||||
|
||||
$this->c->subscriptions->subscribe($this->user, $topic);
|
||||
|
||||
$message = 'Subscribe redirect';
|
||||
|
@ -92,4 +101,16 @@ class Misc extends Page
|
|||
|
||||
return $this->c->Redirect->url($topic->link)->message($message);
|
||||
}
|
||||
|
||||
protected function confirmMessage(): Page
|
||||
{
|
||||
$link = $this->c->Router->link(
|
||||
'EditUserEmail',
|
||||
[
|
||||
'id' => $this->user->id,
|
||||
]
|
||||
);
|
||||
|
||||
return $this->c->Message->message(__('Confirm your email address', $link), true, 100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -311,3 +311,6 @@ msgstr "Moderate forum"
|
|||
|
||||
msgid "When sending email there was an error"
|
||||
msgstr "When sending email there was an error. Please try again later."
|
||||
|
||||
msgid "Confirm your email address"
|
||||
msgstr "First, please <a href=\"%s\">confirm</a> your email address."
|
||||
|
|
|
@ -311,3 +311,6 @@ msgstr "Модерирование раздела"
|
|||
|
||||
msgid "When sending email there was an error"
|
||||
msgstr "При отправке письма возникла ошибка. Попробуйте повторить попытку позже."
|
||||
|
||||
msgid "Confirm your email address"
|
||||
msgstr "Вначале, пожалуйста, <a href=\"%s\">подтвердите</a> свой электронный адрес."
|
||||
|
|
Loading…
Add table
Reference in a new issue