-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix subscribe endpoint when subscribers are disabled #4601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,10 @@ class SubscribeController extends Controller | |
| */ | ||
| public function showSubscribe() | ||
| { | ||
| if (!subscribers_enabled()) { | ||
| return Redirect::route('status-page'); | ||
| } | ||
|
Comment on lines
46
to
+50
|
||
|
|
||
| return View::make('subscribe.subscribe') | ||
| ->withAboutApp(Markdown::convertToHtml(Config::get('setting.app_about'))); | ||
| } | ||
|
|
@@ -56,8 +60,11 @@ public function showSubscribe() | |
| */ | ||
| public function postSubscribe() | ||
| { | ||
| if (!subscribers_enabled()) { | ||
| return Redirect::route('status-page'); | ||
| } | ||
|
Comment on lines
61
to
+65
|
||
|
|
||
| $email = Binput::get('email'); | ||
| $subscriptions = Binput::get('subscriptions'); | ||
| $verified = app(Repository::class)->get('setting.skip_subscriber_verification'); | ||
|
|
||
| try { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subscribe routes are already protected by the
subscribersroute middleware, which performs the same!subscribers_enabled()redirect (see app/Http/Routes/SubscribeRoutes.php:32 and app/Http/Middleware/SubscribersConfigured.php:28-34). Duplicating the gate here in the controller adds a second source of truth that can drift; consider relying on the middleware (or, if the middleware isn’t reliably applied in some deployments, fix the routing/middleware configuration instead of duplicating the check).