api.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use Illuminate\Http\Request;
  3. /*
  4. |--------------------------------------------------------------------------
  5. | API Routes
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here is where you can register API routes for your application. These
  9. | routes are loaded by the RouteServiceProvider within a group which
  10. | is assigned the "api" middleware group. Enjoy building your API!
  11. |
  12. */
  13. Route::group(['middleware' => 'guest:api'], function () {
  14. Route::post('user', 'Auth\RegisterController@register');
  15. Route::post('login', 'Auth\LoginController@login');
  16. Route::get('user/name', 'Auth\UserController@show');
  17. Route::post('user/password/lost', 'Auth\ForgotPasswordController@sendResetLinkEmail')->middleware('AvoidResetPassword');
  18. Route::post('user/password/reset', 'Auth\ResetPasswordController@reset')->name('password.reset');
  19. });
  20. Route::group(['middleware' => 'auth:api'], function() {
  21. Route::get('user', 'Auth\UserController@show');
  22. Route::put('user', 'Auth\UserController@update');
  23. Route::patch('user/password', 'Auth\PasswordController@update');
  24. Route::post('logout', 'Auth\LoginController@logout');
  25. // Route::prefix('settings')->group(function () {
  26. // Route::get('account', 'Settings\AccountController@show');
  27. // Route::post('options', 'Settings\OptionController@store');
  28. // });
  29. Route::get('settings/{name}', 'SettingController@show');
  30. Route::get('settings', 'SettingController@index');
  31. Route::post('settings', 'SettingController@store');
  32. Route::put('settings/{name}', 'SettingController@update');
  33. Route::delete('settings/{name}', 'SettingController@destroy');
  34. Route::delete('twofaccounts', 'TwoFAccountController@batchDestroy');
  35. Route::patch('twofaccounts/withdraw', 'TwoFAccountController@withdraw');
  36. Route::post('twofaccounts/reorder', 'TwoFAccountController@reorder');
  37. Route::post('twofaccounts/preview', 'TwoFAccountController@preview');
  38. Route::get('twofaccounts/{twofaccount}/qrcode', 'QrCodeController@show');
  39. Route::get('twofaccounts/count', 'TwoFAccountController@count');
  40. Route::get('twofaccounts/{id}/otp', 'TwoFAccountController@otp')->where('id', '[0-9]+');
  41. Route::post('twofaccounts/otp', 'TwoFAccountController@otp');
  42. Route::apiResource('twofaccounts', 'TwoFAccountController');
  43. Route::get('groups/{group}/twofaccounts', 'GroupController@accounts');
  44. Route::post('groups/{group}/assign', 'GroupController@assignAccounts');
  45. Route::apiResource('groups', 'GroupController');
  46. Route::post('qrcode/decode', 'QrCodeController@decode');
  47. Route::post('icons', 'IconController@upload');
  48. Route::delete('icons/{icon}', 'IconController@delete');
  49. });