Skip to content

Commit

Permalink
Log user out of other devices when they change their password
Browse files Browse the repository at this point in the history
Signed-off-by: snipe <snipe@snipe.net>
  • Loading branch information
snipe committed Aug 25, 2022
1 parent c9ef49e commit 6fde72a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/ProfileController.php
Expand Up @@ -4,7 +4,7 @@

use App\Http\Requests\ImageUploadRequest;
use App\Models\Setting;
use Auth;
use Illuminate\Support\Facades\Auth;
use Gate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
Expand Down Expand Up @@ -133,7 +133,7 @@ public function api()
public function password()
{
$user = Auth::user();

return view('account/change-password', compact('user'));
}

Expand Down Expand Up @@ -186,6 +186,9 @@ public function passwordSave(Request $request)
if (! $validator->fails()) {
$user->password = Hash::make($request->input('password'));
$user->save();

// Log the user out of other devices
Auth::logoutOtherDevices($request->input('password'));
return redirect()->route('account.password.index')->with('success', 'Password updated!');

}
Expand Down
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Expand Up @@ -43,6 +43,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\CheckForTwoFactor::class,
\Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
\App\Http\Middleware\AssetCountForSidebar::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
],

'api' => [
Expand Down

0 comments on commit 6fde72a

Please sign in to comment.