Browse Source

Add route to get TwoFAccount with sensitive data

Bubka 4 years ago
parent
commit
27dd64a965
2 changed files with 13 additions and 0 deletions
  1. 12 0
      app/Http/Controllers/TwoFAccountController.php
  2. 1 0
      routes/api.php

+ 12 - 0
app/Http/Controllers/TwoFAccountController.php

@@ -93,6 +93,18 @@ class TwoFAccountController extends Controller
     }
     }
 
 
 
 
+    /**
+     * Display the specified resource with all attributes.
+     *
+     * @param  \App\TwoFAccount  $twofaccount
+     * @return \Illuminate\Http\Response
+     */
+    public function showWithSensitive(TwoFAccount $twofaccount)
+    {
+        return response()->json($twofaccount->makeVisible(['uri', 'secret', 'algorithm']), 200);
+    }
+
+
     /**
     /**
      * Save new order.
      * Save new order.
      *
      *

+ 1 - 0
routes/api.php

@@ -38,6 +38,7 @@ Route::group(['middleware' => 'auth:api'], function() {
 
 
     Route::delete('twofaccounts/batch', 'TwoFAccountController@batchDestroy');
     Route::delete('twofaccounts/batch', 'TwoFAccountController@batchDestroy');
     Route::patch('twofaccounts/reorder', 'TwoFAccountController@reorder');
     Route::patch('twofaccounts/reorder', 'TwoFAccountController@reorder');
+    Route::get('twofaccounts/{twofaccount}/withSensitive', 'TwoFAccountController@showWithSensitive');
     Route::apiResource('twofaccounts', 'TwoFAccountController');
     Route::apiResource('twofaccounts', 'TwoFAccountController');
     Route::patch('group/accounts', 'GroupController@associateAccounts');
     Route::patch('group/accounts', 'GroupController@associateAccounts');
     Route::apiResource('groups', 'GroupController');
     Route::apiResource('groups', 'GroupController');