From 2a98b17a577d0c7a4cb05565f01b261d5c6b0dd2 Mon Sep 17 00:00:00 2001 From: Noah Bass Date: Thu, 8 Jan 2015 17:07:48 -0500 Subject: [PATCH 1/3] added a ssl fix for form in /auth/login added a new filter: SslFixFilter added SslFixFilter to auth route added SslFixFilter to RoutingServiceProvider --- app/routes/auth.php | 1 + src/Http/After/SslFixFilter.php | 27 ++++++++++++++++++++++++ src/Providers/RoutingServiceProvider.php | 1 + 3 files changed, 29 insertions(+) create mode 100644 src/Http/After/SslFixFilter.php diff --git a/app/routes/auth.php b/app/routes/auth.php index 1eeef9f1..09cc7fa4 100644 --- a/app/routes/auth.php +++ b/app/routes/auth.php @@ -4,6 +4,7 @@ Route::group(['before' => 'has_setting:app_name', 'namespace' => 'CachetHQ\Cache // Login routes Route::get('/auth/login', [ 'before' => 'guest', + 'after' => 'sslfix', 'as' => 'login', 'uses' => 'AuthController@showLogin', ]); diff --git a/src/Http/After/SslFixFilter.php b/src/Http/After/SslFixFilter.php new file mode 100644 index 00000000..3db91b2e --- /dev/null +++ b/src/Http/After/SslFixFilter.php @@ -0,0 +1,27 @@ +getOriginalContent(); + $output = str_replace('action="http://', 'action="//', $output); + + $response->setContent($output); + } +} diff --git a/src/Providers/RoutingServiceProvider.php b/src/Providers/RoutingServiceProvider.php index 27bc55f0..19351d01 100644 --- a/src/Providers/RoutingServiceProvider.php +++ b/src/Providers/RoutingServiceProvider.php @@ -49,6 +49,7 @@ class RoutingServiceProvider extends ServiceProvider // Cachet's after filters $this->app->router->filter('allowed_domains', 'CachetHQ\Cachet\Http\After\AllowedDomainsFilter'); $this->app->router->filter('cors', 'CachetHQ\Cachet\Http\After\CorsFilter'); + $this->app->router->filter('sslfix', 'CachetHQ\Cachet\Http\After\SslFixFilter'); } /** From f91941a365d78825af3614e6860d55404c12dbf1 Mon Sep 17 00:00:00 2001 From: Noah Bass Date: Fri, 9 Jan 2015 08:55:04 -0500 Subject: [PATCH 2/3] removed sslfix filter --- app/routes/auth.php | 1 - src/Http/After/SslFixFilter.php | 27 ------------------------ src/Providers/RoutingServiceProvider.php | 1 - 3 files changed, 29 deletions(-) delete mode 100644 src/Http/After/SslFixFilter.php diff --git a/app/routes/auth.php b/app/routes/auth.php index 09cc7fa4..1eeef9f1 100644 --- a/app/routes/auth.php +++ b/app/routes/auth.php @@ -4,7 +4,6 @@ Route::group(['before' => 'has_setting:app_name', 'namespace' => 'CachetHQ\Cache // Login routes Route::get('/auth/login', [ 'before' => 'guest', - 'after' => 'sslfix', 'as' => 'login', 'uses' => 'AuthController@showLogin', ]); diff --git a/src/Http/After/SslFixFilter.php b/src/Http/After/SslFixFilter.php deleted file mode 100644 index 3db91b2e..00000000 --- a/src/Http/After/SslFixFilter.php +++ /dev/null @@ -1,27 +0,0 @@ -getOriginalContent(); - $output = str_replace('action="http://', 'action="//', $output); - - $response->setContent($output); - } -} diff --git a/src/Providers/RoutingServiceProvider.php b/src/Providers/RoutingServiceProvider.php index 19351d01..27bc55f0 100644 --- a/src/Providers/RoutingServiceProvider.php +++ b/src/Providers/RoutingServiceProvider.php @@ -49,7 +49,6 @@ class RoutingServiceProvider extends ServiceProvider // Cachet's after filters $this->app->router->filter('allowed_domains', 'CachetHQ\Cachet\Http\After\AllowedDomainsFilter'); $this->app->router->filter('cors', 'CachetHQ\Cachet\Http\After\CorsFilter'); - $this->app->router->filter('sslfix', 'CachetHQ\Cachet\Http\After\SslFixFilter'); } /** From 2ff1c77d7a724e28f948712d3a0ce14874d6d71e Mon Sep 17 00:00:00 2001 From: Noah Bass Date: Fri, 9 Jan 2015 08:56:36 -0500 Subject: [PATCH 3/3] updated form url action now using a relative url: /auth/login fixes http:// vs https:// issues --- app/views/auth/login.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/auth/login.blade.php b/app/views/auth/login.blade.php index 668b6df0..4af53c76 100644 --- a/app/views/auth/login.blade.php +++ b/app/views/auth/login.blade.php @@ -6,7 +6,7 @@ - {{ Form::open() }} + {{ Form::open(['url' => '/auth/login']) }}
{{ trans('dashboard.login.welcome') }}