diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index 7fb12bd75..5712855e6 100644 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -74,8 +74,11 @@
@icon('auth/'. $driver, ['style' => 'width: 56px;height: 56px;'])
@if($user->hasSocialAccount($driver)) - {{ trans('settings.users_social_disconnect') }} +
+ {{ csrf_field() }} + +
@else {{ trans('settings.users_social_connect') }} diff --git a/routes/web.php b/routes/web.php index b6eda7c51..72d089078 100644 --- a/routes/web.php +++ b/routes/web.php @@ -226,7 +226,7 @@ Route::group(['middleware' => 'auth'], function () { Route::get('/login/service/{socialDriver}', 'Auth\SocialController@login'); Route::get('/login/service/{socialDriver}/callback', 'Auth\SocialController@callback'); Route::group(['middleware' => 'auth'], function () { - Route::get('/login/service/{socialDriver}/detach', 'Auth\SocialController@detach'); + Route::post('/login/service/{socialDriver}/detach', 'Auth\SocialController@detach'); }); Route::get('/register/service/{socialDriver}', 'Auth\SocialController@register'); diff --git a/tests/Auth/SocialAuthTest.php b/tests/Auth/SocialAuthTest.php index d412e8c94..60de8fbcb 100644 --- a/tests/Auth/SocialAuthTest.php +++ b/tests/Auth/SocialAuthTest.php @@ -99,9 +99,9 @@ class SocialAuthTest extends TestCase ]); $resp = $this->actingAs($editor)->get($editor->getEditUrl()); - $resp->assertElementContains('a[href$="/login/service/github/detach"]', 'Disconnect Account'); + $resp->assertElementContains('form[action$="/login/service/github/detach"]', 'Disconnect Account'); - $resp = $this->get('/login/service/github/detach'); + $resp = $this->post('/login/service/github/detach'); $resp->assertRedirect($editor->getEditUrl()); $resp = $this->followRedirects($resp); $resp->assertSee('Github account was successfully disconnected from your profile.');