From 838beac285deb5b1969f87ea18f6eaac2778080a Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 10 Aug 2016 12:56:18 +0100 Subject: [PATCH] Don't allow redirecting to someones subscription. Closes #2047 --- app/Http/Controllers/SubscribeController.php | 8 ++-- resources/views/subscribe/manage.blade.php | 48 +++++++++++++++----- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/app/Http/Controllers/SubscribeController.php b/app/Http/Controllers/SubscribeController.php index 953f7757..f8926c3c 100644 --- a/app/Http/Controllers/SubscribeController.php +++ b/app/Http/Controllers/SubscribeController.php @@ -69,12 +69,12 @@ class SubscribeController extends Controller ->withErrors($e->getMessageBag()); } - $message = $subscription->is_verified ? - trans('cachet.subscriber.email.already-subscribed', ['email' => $email]) : - trans('cachet.subscriber.email.subscribed'); + if ($subscription->is_verified) { + return Redirect::route('status-page')->withSuccess(trans('cachet.subscriber.email.already-subscribed', ['email' => $email])); + } return Redirect::route('subscribe.manage', $subscription->verify_code) - ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), $message)); + ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('cachet.subscriber.email.subscribed'))); } /** diff --git a/resources/views/subscribe/manage.blade.php b/resources/views/subscribe/manage.blade.php index 3bcade12..31c569cc 100644 --- a/resources/views/subscribe/manage.blade.php +++ b/resources/views/subscribe/manage.blade.php @@ -20,18 +20,44 @@
-
-
- {{ trans('cachet.subscriber.manage.my_subscriptions') }} -
-
- @if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty()) - @include('partials.components_form') - @else -

{{ trans('cachet.subscriber.manage.no_subscriptions') }}

- @endif -
+ @if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty()) + @if($component_groups->count() > 0) + @foreach($component_groups as $componentGroup) +
+ @if($componentGroup->enabled_components->count() > 0) +
+ + {{ $componentGroup->name }} +
+ Select All +  |  + Deselect All +
+
+
+ @foreach($componentGroup->enabled_components()->orderBy('order')->get() as $component) + @include('partials.component_input', compact($component)) + @endforeach +
+ @endif
+ @endforeach + @endif + + @if($ungrouped_components->count() > 0) +
    +
    + {{ trans('cachet.components.group.other') }} +
    + @foreach($ungrouped_components as $component) + @include('partials.component_input', compact($component)) + @endforeach +
+ @endif + @else +

{{ trans('cachet.subscriber.manage.no_subscriptions') }}

+ @endif +