Skip to content
Permalink
Browse files
Merge branch 'hotfix/logout'
  • Loading branch information
baijunyao committed Nov 8, 2021
2 parents 931809d + e5845cf commit ec12f3e68b0705bc65fe1f77decb514a430d35b9

Large diffs are not rendered by default.

@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=204bfbbea2a97d8cd114",
"/js/app.js": "/js/app.js?id=920094002fb785cdddf8",
"/css/app.css": "/css/app.css?id=2227ffec5a875e366447"
}
@@ -73,6 +73,12 @@ $(function(){
}
});

$('.js-logout-btn').click(function () {
$.post(ajaxLogoutUrl, function () {
window.location.reload();
});
})

// 百度自动提交
(function(){
var bp = document.createElement('script');
@@ -60,7 +60,7 @@
<li class="b-user-info" data-user-id="{{ auth()->guard('socialite')->user()->id }}">
<span><img class="b-head_img" src="{{ auth()->guard('socialite')->user()->avatar }}" alt="{{ auth()->guard('socialite')->user()->name }}" title="{{ auth()->guard('socialite')->user()->name }}" /></span>
<span class="b-nickname">{{ auth()->guard('socialite')->user()->name }}</span>
<span><a href="{{ url('auth/socialite/logout') }}">{{ translate('Sign out') }}</a></span>
<span><a class="js-logout-btn" href="javascript:;">{{ translate('Sign out') }}</a></span>
</li>
@else
<li class="b-nav-cname b-nav-login">
@@ -237,6 +237,7 @@
ajaxCommentUrl = "{{ url('comments') }}";
ajaxLikeUrl = "{{ url('likes/store') }}";
ajaxUnLikeUrl = "{{ url('likes/destroy') }}";
ajaxLogoutUrl = "{{ url('auth/socialite/logout') }}";
socialiteUserShowUrl = "{{ url('socialiteUsers/me') }}";
titleName = '{{ config('app.name') }}';
jsSocialsConfig = {!! config('bjyblog.social_share.jssocials_config') !!};
@@ -5,7 +5,6 @@
// oauth to socialite
Route::get('auth/oauth/redirectToProvider/{service}', App\Http\Controllers\RedirectController::class . '@authOauthRedirectToProvider');
Route::get('auth/oauth/handleProviderCallback/{service}', App\Http\Controllers\RedirectController::class . '@handleProviderCallback');
Route::get('auth/oauth/logout', \App\Http\Controllers\RedirectController::class . '@logout');
Route::get('login', \App\Http\Controllers\RedirectController::class . '@login')->name('login');

Route::redirect('/category/{category}/{slug?}', '/categories/{category}/{slug?}', 301);
@@ -37,6 +37,6 @@
// 获取用户资料并登录
Route::get('handleProviderCallback/{service}', \App\Http\Controllers\Auth\SocialiteController::class . '@handleProviderCallback')->name('handleProviderCallback');
// 退出登录
Route::get('logout', \App\Http\Controllers\Auth\SocialiteController::class . '@logout')->name('logout');
Route::post('logout', \App\Http\Controllers\Auth\SocialiteController::class . '@logout')->name('logout');
});
});
@@ -130,7 +130,7 @@ public function testLogout()
{
$this->loginByUserId(1, 'socialite');
$this->assertAuthenticated('socialite');
$this->get('auth/socialite/logout')->assertStatus(302);
$this->post('auth/socialite/logout')->assertStatus(302);
$this->assertGuest('socialite');
}
}
@@ -18,11 +18,6 @@ public function testHandleProviderCallback()
$this->get('auth/oauth/handleProviderCallback/github?code=xxx')->assertRedirect('auth/socialite/handleProviderCallback/github?code=xxx');
}

public function testLogout()
{
$this->get('auth/oauth/logout')->assertRedirect('auth/socialite/logout');
}

public function testLogin()
{
$this->get('login')->assertRedirect('auth/socialite/redirectToProvider/github');

0 comments on commit ec12f3e

Please sign in to comment.