diff --git a/UPGRADE.md b/UPGRADE.md index 63e955571..a3d49766f 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,11 @@ # Upgrade Guide +## General Notes + +After updating Passport, you should always re-publish and re-compile the Vue "quickstart" assets if you're using them: + + php artisan vendor:publish --tag=passport-views --force + ## Upgrading To 9.0 From 8.0 ### Support For Multiple Guards diff --git a/resources/js/components/Clients.vue b/resources/js/components/Clients.vue index 7a50deea8..a89003fff 100644 --- a/resources/js/components/Clients.vue +++ b/resources/js/components/Clients.vue @@ -224,6 +224,35 @@ + + + @@ -236,6 +265,8 @@ return { clients: [], + clientSecret: null, + createForm: { errors: [], name: '', @@ -341,17 +372,17 @@ axios[method](uri, form) .then(response => { - if (method === 'post') { - this.clients.push(response.data); - } else { - this.getClients(); - } + this.getClients(); form.name = ''; form.redirect = ''; form.errors = []; $(modal).modal('hide'); + + if (response.data.plainSecret) { + this.showClientSecret(response.data.plainSecret); + } }) .catch(error => { if (typeof error.response.data === 'object') { @@ -362,6 +393,15 @@ }); }, + /** + * Show the given client secret to the user. + */ + showClientSecret(clientSecret) { + this.clientSecret = clientSecret; + + $('#modal-client-secret').modal('show'); + }, + /** * Destroy the given client. */ diff --git a/src/Http/Controllers/ClientController.php b/src/Http/Controllers/ClientController.php index 219973441..7ce9fde04 100644 --- a/src/Http/Controllers/ClientController.php +++ b/src/Http/Controllers/ClientController.php @@ -89,7 +89,7 @@ public function store(Request $request) ); if (Passport::$hashesClientSecrets) { - return ['secret' => $client->plainSecret] + $client->toArray(); + return ['plainSecret' => $client->plainSecret] + $client->toArray(); } return $client->makeVisible('secret');