diff --git a/src/Console/ClientCommand.php b/src/Console/ClientCommand.php
index c46f63bc..7bbfb3a6 100644
--- a/src/Console/ClientCommand.php
+++ b/src/Console/ClientCommand.php
@@ -67,7 +67,7 @@ protected function createPersonalClient(ClientRepository $clients)
null, $name, 'http://localhost'
);
- $this->info('Personal access client created successfully.');
+ $this->components->info('Personal access client created successfully.');
$this->outputClientDetails($client);
}
@@ -97,7 +97,7 @@ protected function createPasswordClient(ClientRepository $clients)
null, $name, 'http://localhost', $provider
);
- $this->info('Password grant client created successfully.');
+ $this->components->info('Password grant client created successfully.');
$this->outputClientDetails($client);
}
@@ -119,7 +119,7 @@ protected function createClientCredentialsClient(ClientRepository $clients)
null, $name, ''
);
- $this->info('New client created successfully.');
+ $this->components->info('New client created successfully.');
$this->outputClientDetails($client);
}
@@ -149,7 +149,7 @@ protected function createAuthCodeClient(ClientRepository $clients)
$userId, $name, $redirect, null, false, false, ! $this->option('public')
);
- $this->info('New client created successfully.');
+ $this->components->info('New client created successfully.');
$this->outputClientDetails($client);
}
@@ -167,7 +167,7 @@ protected function outputClientDetails(Client $client)
$this->line('');
}
- $this->line('Client ID: '.$client->getKey());
- $this->line('Client secret: '.$client->plainSecret);
+ $this->components->twoColumnDetail('Client ID', $client->getKey());
+ $this->components->twoColumnDetail('Client secret', $client->plainSecret);
}
}
diff --git a/src/Console/HashCommand.php b/src/Console/HashCommand.php
index 2e114d55..0ddcd282 100644
--- a/src/Console/HashCommand.php
+++ b/src/Console/HashCommand.php
@@ -29,7 +29,7 @@ class HashCommand extends Command
public function handle()
{
if (! Passport::$hashesClientSecrets) {
- $this->warn('Please enable client hashing yet in your AppServiceProvider before continuing.');
+ $this->components->warn('Please enable client hashing yet in your AppServiceProvider before continuing.');
return;
}
@@ -49,7 +49,7 @@ public function handle()
])->save();
}
- $this->info('All client secrets were successfully hashed.');
+ $this->components->info('All client secrets were successfully hashed.');
}
}
}
diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php
index 0aff2cbf..921c9be6 100644
--- a/src/Console/InstallCommand.php
+++ b/src/Console/InstallCommand.php
@@ -31,8 +31,6 @@ class InstallCommand extends Command
*/
public function handle()
{
- $provider = in_array('users', array_keys(config('auth.providers'))) ? 'users' : null;
-
$this->call('passport:keys', ['--force' => $this->option('force'), '--length' => $this->option('length')]);
$this->call('vendor:publish', ['--tag' => 'passport-migrations']);
@@ -41,10 +39,16 @@ public function handle()
$this->configureUuids();
}
- $this->call('migrate');
+ if ($this->confirm('Would you like to run all pending database migrations?', true)) {
+ $this->call('migrate');
+
+ if ($this->confirm('Would you like to create the "personal access" and "password grant" clients?', true)) {
+ $provider = in_array('users', array_keys(config('auth.providers'))) ? 'users' : null;
- $this->call('passport:client', ['--personal' => true, '--name' => config('app.name').' Personal Access Client']);
- $this->call('passport:client', ['--password' => true, '--name' => config('app.name').' Password Grant Client', '--provider' => $provider]);
+ $this->call('passport:client', ['--personal' => true, '--name' => config('app.name').' Personal Access Client']);
+ $this->call('passport:client', ['--password' => true, '--name' => config('app.name').' Password Grant Client', '--provider' => $provider]);
+ }
+ }
}
/**
diff --git a/src/Console/KeysCommand.php b/src/Console/KeysCommand.php
index 5ea3b19c..6c4d6305 100644
--- a/src/Console/KeysCommand.php
+++ b/src/Console/KeysCommand.php
@@ -39,7 +39,7 @@ public function handle()
];
if ((file_exists($publicKey) || file_exists($privateKey)) && ! $this->option('force')) {
- $this->error('Encryption keys already exist. Use the --force option to overwrite them.');
+ $this->components->error('Encryption keys already exist. Use the --force option to overwrite them.');
return 1;
} else {
@@ -60,7 +60,7 @@ public function handle()
chmod($privateKey, 0600);
}
- $this->info('Encryption keys generated successfully.');
+ $this->components->info('Encryption keys generated successfully.');
}
return 0;
diff --git a/src/Console/PurgeCommand.php b/src/Console/PurgeCommand.php
index 9d9e66bc..a5ed078d 100644
--- a/src/Console/PurgeCommand.php
+++ b/src/Console/PurgeCommand.php
@@ -41,22 +41,22 @@ public function handle()
Passport::refreshToken()->where('revoked', 1)->orWhereDate('expires_at', '<', $expired)->delete();
$this->option('hours')
- ? $this->info('Purged revoked items and items expired for more than '.$this->option('hours').' hours.')
- : $this->info('Purged revoked items and items expired for more than seven days.');
+ ? $this->components->info('Purged revoked items and items expired for more than '.$this->option('hours').' hours.')
+ : $this->components->info('Purged revoked items and items expired for more than seven days.');
} elseif ($this->option('revoked')) {
Passport::token()->where('revoked', 1)->delete();
Passport::authCode()->where('revoked', 1)->delete();
Passport::refreshToken()->where('revoked', 1)->delete();
- $this->info('Purged revoked items.');
+ $this->components->info('Purged revoked items.');
} elseif ($this->option('expired')) {
Passport::token()->whereDate('expires_at', '<', $expired)->delete();
Passport::authCode()->whereDate('expires_at', '<', $expired)->delete();
Passport::refreshToken()->whereDate('expires_at', '<', $expired)->delete();
$this->option('hours')
- ? $this->info('Purged items expired for more than '.$this->option('hours').' hours.')
- : $this->info('Purged items expired for more than seven days.');
+ ? $this->components->info('Purged items expired for more than '.$this->option('hours').' hours.')
+ : $this->components->info('Purged items expired for more than seven days.');
}
}
}
diff --git a/tests/Feature/KeysCommandTest.php b/tests/Feature/KeysCommandTest.php
index 3d2f4b98..a3200fdc 100644
--- a/tests/Feature/KeysCommandTest.php
+++ b/tests/Feature/KeysCommandTest.php
@@ -14,6 +14,6 @@ public function testPrivateAndPublicKeysShouldNotBeGeneratedTwice()
{
$this->artisan('passport:keys')
->assertFailed()
- ->expectsOutput('Encryption keys already exist. Use the --force option to overwrite them.');
+ ->expectsOutputToContain('Encryption keys already exist. Use the --force option to overwrite them.');
}
}