app/Http/Controllers/Auth/OAuthController.php: check trashed records before trying to login via oauth.
This commit is contained in:
parent
de19260f35
commit
d8917e118b
1 changed files with 6 additions and 0 deletions
|
|
@ -30,6 +30,12 @@ class OAuthController extends Controller
|
|||
{
|
||||
$oauth = Socialite::driver($driver)->stateless()->user();
|
||||
|
||||
// Check that account is not deleted before trying to find/create user and login.
|
||||
if (User::onlyTrashed()->where("{$driver}_id", $oauth->getId())->first()) {
|
||||
return redirect('/')
|
||||
->with(['error' => "Account suspended."]);
|
||||
}
|
||||
|
||||
$user = User::firstOrCreate([ "{$driver}_id" => $oauth->getId() ], [
|
||||
'username' => $oauth->getNickname()
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue