NOW MANAGED ON CODEBERG
Made social account detach a POST request
Dan Brown7d951b842c76
diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.phpindex 7fb12bd75..5712855e6 100644--- a/resources/views/users/edit.blade.php+++ b/resources/views/users/edit.blade.php@@ -74,8 +74,11 @@<div role="presentation">@icon('auth/'. $driver, ['style' => 'width: 56px;height: 56px;'])</div><div>@if($user->hasSocialAccount($driver))- <a href="{{ url("/login/service/{$driver}/detach") }}" aria-label="{{ trans('settings.users_social_disconnect') }} - {{ $driver }}"- class="button small outline">{{ trans('settings.users_social_disconnect') }}</a>+ <form action="{{ url("/login/service/{$driver}/detach") }}" method="POST">+ {{ csrf_field() }}+ <button aria-label="{{ trans('settings.users_social_disconnect') }} - {{ $driver }}"+ class="button small outline">{{ trans('settings.users_social_disconnect') }}</button>+ </form>@else<a href="{{ url("/login/service/{$driver}") }}" aria-label="{{ trans('settings.users_social_connect') }} - {{ $driver }}"class="button small outline">{{ trans('settings.users_social_connect') }}</a>diff --git a/routes/web.php b/routes/web.phpindex 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.phpindex 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.');