mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 13:38:20 +01:00
Added option to skip subscriber verification. Closes #1990
This commit is contained in:
parent
0d90f0459b
commit
7f261a218a
@ -11,7 +11,9 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Bus\Handlers\Events\Subscriber;
|
||||
|
||||
use CachetHQ\Cachet\Bus\Commands\Subscriber\VerifySubscriberCommand;
|
||||
use CachetHQ\Cachet\Bus\Events\Subscriber\SubscriberHasSubscribedEvent;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Mail\Message;
|
||||
|
||||
@ -24,6 +26,13 @@ class SendSubscriberVerificationEmailHandler
|
||||
*/
|
||||
protected $mailer;
|
||||
|
||||
/**
|
||||
* The illuminate config instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Create a new send subscriber verification email handler.
|
||||
*
|
||||
@ -31,9 +40,10 @@ class SendSubscriberVerificationEmailHandler
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(MailQueue $mailer)
|
||||
public function __construct(MailQueue $mailer, Repository $config)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,10 +55,17 @@ class SendSubscriberVerificationEmailHandler
|
||||
*/
|
||||
public function handle(SubscriberHasSubscribedEvent $event)
|
||||
{
|
||||
// If we've enabled verification skipping, then just verify the subscriber right now.
|
||||
if ($this->config->get('setting.skip_subscriber_verification')) {
|
||||
dispatch(new VerifySubscriberCommand($event->subscriber));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$mail = [
|
||||
'email' => $event->subscriber->email,
|
||||
'subject' => 'Confirm your subscription.',
|
||||
'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]),
|
||||
'email' => $event->subscriber->email,
|
||||
'subject' => 'Confirm your subscription.',
|
||||
'link' => route('subscribe.verify', ['code' => $event->subscriber->verify_code]),
|
||||
];
|
||||
|
||||
$this->mailer->queue([
|
||||
|
@ -77,4 +77,15 @@ return [
|
||||
*/
|
||||
|
||||
'show_timezone' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Skip subscriber verifications
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Whether to allow skipping of subscriber verifications.
|
||||
|
|
||||
*/
|
||||
|
||||
'skip_subscriber_verification' => false,
|
||||
];
|
||||
|
@ -109,6 +109,7 @@ return [
|
||||
'banner' => 'Banner Image',
|
||||
'banner-help' => "It's recommended that you upload files no bigger than 930px wide .",
|
||||
'subscribers' => 'Allow people to signup to email notifications?',
|
||||
'skip_subscriber_verification' => 'Skip verifying of users? (Be warned, you could be spammed)',
|
||||
'automatic_localization' => 'Automatically localise your status page to your visitor\'s language?',
|
||||
'enable_external_dependencies' => 'Enable Third Party Dependencies (Google Fonts, Trackers, etc...)',
|
||||
'show_timezone' => 'Show the timezone the status page is running in.',
|
||||
|
@ -62,6 +62,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="hidden" value="0" name="skip_subscriber_verification">
|
||||
<input type="checkbox" value="1" name="skip_subscriber_verification" {{ Config::get('setting.skip_subscriber_verification') ? 'checked' : null }}>
|
||||
{{ trans('forms.settings.app-setup.skip_subscriber_verification') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="checkbox">
|
||||
|
Loading…
x
Reference in New Issue
Block a user