Added subcriber verified scope and already subscribed msg

This commit is contained in:
Joseph Cohen
2015-12-09 15:29:41 -06:00
parent e099b45495
commit 412c119131
4 changed files with 17 additions and 2 deletions

View File

@@ -15,6 +15,7 @@ use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Commands\Subscriber\SubscribeSubscriberCommand;
use CachetHQ\Cachet\Commands\Subscriber\UnsubscribeSubscriberCommand;
use CachetHQ\Cachet\Commands\Subscriber\VerifySubscriberCommand;
use CachetHQ\Cachet\Exceptions\AlreadySubscribedException;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Models\Subscriber;
use GrahamCampbell\Binput\Facades\Binput;
@@ -50,6 +51,10 @@ class SubscribeController extends Controller
{
try {
$this->dispatch(new SubscribeSubscriberCommand(Binput::get('email')));
} catch (AlreadySubscribedException $e) {
return Redirect::route('subscribe.subscribe')
->withTitle(sprintf('<strong>%s</strong> %s', trans('dashboard.notifications.whoops'), trans('cachet.subscriber.email.failure')))
->withErrors($e->getMessage());
} catch (ValidationException $e) {
return Redirect::route('subscribe.subscribe')
->withInput(Binput::all())