A free open source IT asset/license management system
Add a force override
snipe1ac293a12a1b
diff --git a/app/Console/Commands/KillAllSessions.php b/app/Console/Commands/KillAllSessions.phpindex f3a8b22909..043be0fa18 100644--- a/app/Console/Commands/KillAllSessions.php+++ b/app/Console/Commands/KillAllSessions.php@@ -11,7 +11,7 @@ class KillAllSessions extends Command** @var string*/- protected $signature = 'snipeit:global-logout';+ protected $signature = 'snipeit:global-logout {--force : Skip the danger prompt; assuming you enter "y"} ';/*** The console command description.@@ -37,21 +37,23 @@ class KillAllSessions extends Command*/public function handle(){- if ($this->confirm("\n****************************************************\nTHIS WILL FORCE A LOGIN FOR ALL LOGGED IN USERS.\n\nAre you SURE you wish to continue? ")) {- $session_files = glob(storage_path("framework/sessions/*"));+ if (!$this->option('force') && !$this->confirm("****************************************************\nTHIS WILL FORCE A LOGIN FOR ALL LOGGED IN USERS.\n\nAre you SURE you wish to continue? ")) {+ return $this->error("Session loss not confirmed");+ }- $count = 0;- foreach ($session_files as $file) {+ $session_files = glob(storage_path("framework/sessions/*"));- if (is_file($file))- unlink($file);- $count++;- }- \DB::table('users')->update(['remember_token' => null]);+ $count = 0;+ foreach ($session_files as $file) {- $this->info($count. ' sessions cleared!');+ if (is_file($file))+ unlink($file);+ $count++;}-//+ \DB::table('users')->update(['remember_token' => null]);++ $this->info($count. ' sessions cleared!');+}}