Browse Source

Add route to get TwoFAccount with sensitive data

Bubka 4 năm trước cách đây
mục cha
commit
27dd64a965
2 tập tin đã thay đổi với 13 bổ sung0 xóa
  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.
      *

+ 1 - 0
routes/api.php

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