Skip to content

Commit e190981

Browse files
authoredApr 7, 2021
Check for session before attempting to invalidate (#750)
* Check for session before attempting to invalidate * Fix formatting, missing a space * $request->hasSession() not $request->session
1 parent 39d50ec commit e190981

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

Diff for: ‎src/Http/Livewire/DeleteUserForm.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ public function deleteUser(Request $request, DeletesUsers $deleter, StatefulGuar
6464

6565
$auth->logout();
6666

67-
$request->session()->invalidate();
68-
$request->session()->regenerateToken();
67+
if ($request->hasSession()) {
68+
$request->session()->invalidate();
69+
$request->session()->regenerateToken();
70+
}
6971

7072
return redirect('/');
7173
}

2 commit comments

Comments
 (2)

Loots-it commented on Apr 8, 2021

@Loots-it
Contributor

Isn't this also necessary in src/Http/Controllers/Inertia/CurrentUserController.php @inmanturbo, for inertia?

inmanturbo commented on Apr 8, 2021

@inmanturbo
ContributorAuthor

@Loots-it nah works fine with inertia

webpack compiled successfully
Done in 7.38s.
➜  jetstream-demo nano .env
➜  jetstream-demo nano phpunit.xml
➜  jetstream-demo php artisan test                     

   PASS  Tests\Unit\ExampleTest
  ✓ basic test

   WARN  Tests\Feature\ApiTokenPermissionsTest
  - api token permissions can be updated → API support is not enabled.

   PASS  Tests\Feature\AuthenticationTest
  ✓ login screen can be rendered
  ✓ users can authenticate using the login screen
  ✓ users can not authenticate with invalid password

   PASS  Tests\Feature\BrowserSessionsTest
  ✓ other browser sessions can be logged out

   WARN  Tests\Feature\CreateApiTokenTest
  - api tokens can be created → API support is not enabled.

   PASS  Tests\Feature\DeleteAccountTest
  ✓ user accounts can be deleted
  ✓ correct password must be provided before account can be deleted

   WARN  Tests\Feature\DeleteApiTokenTest
  - api tokens can be deleted → API support is not enabled.

   WARN  Tests\Feature\EmailVerificationTest
  - email verification screen can be rendered → Email verification not enabled.
  - email can be verified → Email verification not enabled.
  - email can not verified with invalid hash → Email verification not enabled.

   PASS  Tests\Feature\ExampleTest
  ✓ basic test

   PASS  Tests\Feature\PasswordConfirmationTest
  ✓ confirm password screen can be rendered
  ✓ password can be confirmed
  ✓ password is not confirmed with invalid password

   PASS  Tests\Feature\PasswordResetTest
  ✓ reset password link screen can be rendered
  ✓ reset password link can be requested
  ✓ reset password screen can be rendered
  ✓ password can be reset with valid token

   PASS  Tests\Feature\ProfileInformationTest
  ✓ profile information can be updated

   PASS  Tests\Feature\RegistrationTest
  ✓ registration screen can be rendered
  ✓ new users can register

   PASS  Tests\Feature\TwoFactorAuthenticationSettingsTest
  ✓ two factor authentication can be enabled
  ✓ recovery codes can be regenerated
  ✓ two factor authentication can be disabled

   PASS  Tests\Feature\UpdatePasswordTest
  ✓ password can be updated
  ✓ current password must be correct
  ✓ new passwords must match

  Tests:  6 skipped, 24 passed
  Time:   1.86s

see livewire/livewire#936

which is why I thought to submit #752.
But it's not broken ATM. All args lead to green.

Please sign in to comment.