Permalink
Browse files

Delete keys when revoked

  • Loading branch information...
insom committed Mar 22, 2016
1 parent 2493f40 commit a17be7868f4b80675aaed7d5898aee8d74cb2a86
Showing with 4 additions and 4 deletions.
  1. +3 −3 app/Http/Controllers/Dashboard/UserController.php
  2. +1 −1 app/Http/Routes/DashboardRoutes.php
@@ -13,6 +13,7 @@
use AltThree\Validator\ValidationException;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Cachet\Models\ApiKey;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Auth;
@@ -71,10 +72,9 @@ public function postUser()
*
* @return \Illuminate\View\View
*/
public function regenerateApiKey(User $user)
public function revokeApiKey(User $user, ApiKey $api_key)
{
$user->api_key = User::generateApiKey();
$user->save();
$api_key->delete();
return Redirect::route('dashboard.user');
}
@@ -220,7 +220,7 @@ public function map(Registrar $router)
'uses' => 'UserController@showUser',
]);
$router->post('/', 'UserController@postUser');
$router->get('{user}/api/regen', 'UserController@regenerateApiKey');
$router->get('{user}/api/revoke/{api_key}', 'UserController@revokeApiKey');
});
$router->group(['prefix' => 'api'], function (Registrar $router) {

0 comments on commit a17be78

Please sign in to comment.