mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 08:13:11 +01:00
Rewrite routes declaration using ::class fully qualified name
This commit is contained in:
parent
e8d044c131
commit
235b5f0b1e
@ -1,5 +1,11 @@
|
||||
<?php
|
||||
|
||||
use App\Api\v1\Controllers\GroupController;
|
||||
use App\Api\v1\Controllers\IconController;
|
||||
use App\Api\v1\Controllers\QrCodeController;
|
||||
use App\Api\v1\Controllers\SettingController;
|
||||
use App\Api\v1\Controllers\TwoFAccountController;
|
||||
use App\Api\v1\Controllers\UserController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
@ -11,39 +17,38 @@
|
||||
/**
|
||||
* Unprotected routes
|
||||
*/
|
||||
Route::get('user/name', 'UserController@show')->name('user.show.name');
|
||||
|
||||
Route::get('user/name', [UserController::class, 'show'])->name('user.show.name');
|
||||
|
||||
/**
|
||||
* Routes protected by the api authentication guard
|
||||
*/
|
||||
Route::group(['middleware' => 'auth:api-guard'], function () {
|
||||
Route::get('user', 'UserController@show')->name('user.show'); // Returns email address in addition to the username
|
||||
Route::get('user', [UserController::class, 'show'])->name('user.show'); // Returns email address in addition to the username
|
||||
|
||||
Route::get('settings/{settingName}', 'SettingController@show')->name('settings.show');
|
||||
Route::get('settings', 'SettingController@index')->name('settings.index');
|
||||
Route::post('settings', 'SettingController@store')->name('settings.store');
|
||||
Route::put('settings/{settingName}', 'SettingController@update')->name('settings.update');
|
||||
Route::delete('settings/{settingName}', 'SettingController@destroy')->name('settings.destroy');
|
||||
Route::get('settings/{settingName}', [SettingController::class, 'show'])->name('settings.show');
|
||||
Route::get('settings', [SettingController::class, 'index'])->name('settings.index');
|
||||
Route::post('settings', [SettingController::class, 'store'])->name('settings.store');
|
||||
Route::put('settings/{settingName}', [SettingController::class, 'update'])->name('settings.update');
|
||||
Route::delete('settings/{settingName}', [SettingController::class, 'destroy'])->name('settings.destroy');
|
||||
|
||||
Route::delete('twofaccounts', 'TwoFAccountController@batchDestroy')->name('twofaccounts.batchDestroy');
|
||||
Route::patch('twofaccounts/withdraw', 'TwoFAccountController@withdraw')->name('twofaccounts.withdraw');
|
||||
Route::post('twofaccounts/reorder', 'TwoFAccountController@reorder')->name('twofaccounts.reorder');
|
||||
Route::post('twofaccounts/migration', 'TwoFAccountController@migrate')->name('twofaccounts.migrate');
|
||||
Route::post('twofaccounts/preview', 'TwoFAccountController@preview')->name('twofaccounts.preview');
|
||||
Route::get('twofaccounts/{twofaccount}/qrcode', 'QrCodeController@show')->name('twofaccounts.show.qrcode');
|
||||
Route::get('twofaccounts/count', 'TwoFAccountController@count')->name('twofaccounts.count');
|
||||
Route::get('twofaccounts/{id}/otp', 'TwoFAccountController@otp')->where('id', '[0-9]+')->name('twofaccounts.show.otp');
|
||||
Route::post('twofaccounts/otp', 'TwoFAccountController@otp')->name('twofaccounts.otp');
|
||||
Route::apiResource('twofaccounts', 'TwoFAccountController');
|
||||
Route::delete('twofaccounts', [TwoFAccountController::class, 'batchDestroy'])->name('twofaccounts.batchDestroy');
|
||||
Route::patch('twofaccounts/withdraw', [TwoFAccountController::class, 'withdraw'])->name('twofaccounts.withdraw');
|
||||
Route::post('twofaccounts/reorder', [TwoFAccountController::class, 'reorder'])->name('twofaccounts.reorder');
|
||||
Route::post('twofaccounts/migration', [TwoFAccountController::class, 'migrate'])->name('twofaccounts.migrate');
|
||||
Route::post('twofaccounts/preview', [TwoFAccountController::class, 'preview'])->name('twofaccounts.preview');
|
||||
Route::get('twofaccounts/{twofaccount}/qrcode', [QrCodeController::class, 'show'])->name('twofaccounts.show.qrcode');
|
||||
Route::get('twofaccounts/count', [TwoFAccountController::class, 'count'])->name('twofaccounts.count');
|
||||
Route::get('twofaccounts/{id}/otp', [TwoFAccountController::class, 'otp'])->where('id', '[0-9]+')->name('twofaccounts.show.otp');
|
||||
Route::post('twofaccounts/otp', [TwoFAccountController::class, 'otp'])->name('twofaccounts.otp');
|
||||
Route::apiResource('twofaccounts', TwoFAccountController::class);
|
||||
|
||||
Route::get('groups/{group}/twofaccounts', 'GroupController@accounts')->name('groups.show.twofaccounts');
|
||||
Route::post('groups/{group}/assign', 'GroupController@assignAccounts')->name('groups.assign.twofaccounts');
|
||||
Route::apiResource('groups', 'GroupController');
|
||||
Route::get('groups/{group}/twofaccounts', [GroupController::class, 'accounts'])->name('groups.show.twofaccounts');
|
||||
Route::post('groups/{group}/assign', [GroupController::class, 'assignAccounts'])->name('groups.assign.twofaccounts');
|
||||
Route::apiResource('groups', GroupController::class);
|
||||
|
||||
Route::post('qrcode/decode', 'QrCodeController@decode')->name('qrcode.decode');
|
||||
Route::post('qrcode/decode', [QrCodeController::class, 'decode'])->name('qrcode.decode');
|
||||
|
||||
Route::post('icons/default', 'IconController@fetch')->name('icons.fetch');
|
||||
Route::post('icons', 'IconController@upload')->name('icons.upload');
|
||||
Route::delete('icons/{icon}', 'IconController@delete')->name('icons.delete');
|
||||
});
|
||||
Route::post('icons/default', [IconController::class, 'fetch'])->name('icons.fetch');
|
||||
Route::post('icons', [IconController::class, 'upload'])->name('icons.upload');
|
||||
Route::delete('icons/{icon}', [IconController::class, 'delete'])->name('icons.delete');
|
||||
});
|
||||
|
@ -1,11 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\Auth\WebAuthnManageController;
|
||||
use App\Http\Controllers\Auth\WebAuthnRegisterController;
|
||||
use App\Http\Controllers\Auth\WebAuthnLoginController;
|
||||
use App\Http\Controllers\Auth\ForgotPasswordController;
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Controllers\Auth\PasswordController;
|
||||
use App\Http\Controllers\Auth\RegisterController;
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
use App\Http\Controllers\Auth\UserController;
|
||||
use App\Http\Controllers\Auth\WebAuthnDeviceLostController;
|
||||
use App\Http\Controllers\Auth\WebAuthnLoginController;
|
||||
use App\Http\Controllers\Auth\WebAuthnManageController;
|
||||
use App\Http\Controllers\Auth\WebAuthnRecoveryController;
|
||||
use App\Http\Controllers\Auth\WebAuthnRegisterController;
|
||||
use App\Http\Controllers\SinglePageController;
|
||||
use App\Http\Controllers\SystemController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Laravel\Passport\Http\Controllers\PersonalAccessTokenController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -17,9 +26,9 @@
|
||||
* Routes that only work for unauthenticated user (return an error otherwise)
|
||||
*/
|
||||
Route::group(['middleware' => ['guest', 'rejectIfDemoMode']], function () {
|
||||
Route::post('user', 'Auth\RegisterController@register')->name('user.register');
|
||||
Route::post('user/password/lost', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('user.password.lost');;
|
||||
Route::post('user/password/reset', 'Auth\ResetPasswordController@reset')->name('password.reset');
|
||||
Route::post('user', [RegisterController::class, 'register'])->name('user.register');
|
||||
Route::post('user/password/lost', [ForgotPasswordController::class, 'sendResetLinkEmail'])->name('user.password.lost');
|
||||
Route::post('user/password/reset', [ResetPasswordController::class, 'reset'])->name('password.reset');
|
||||
Route::post('webauthn/login/options', [WebAuthnLoginController::class, 'options'])->name('webauthn.login.options');
|
||||
Route::post('webauthn/lost', [WebAuthnDeviceLostController::class, 'sendRecoveryEmail'])->name('webauthn.lost');
|
||||
});
|
||||
@ -36,7 +45,7 @@
|
||||
* that can be requested max 10 times per minute by the same IP
|
||||
*/
|
||||
Route::group(['middleware' => ['SkipIfAuthenticated', 'throttle:10,1']], function () {
|
||||
Route::post('user/login', 'Auth\LoginController@login')->name('user.login');
|
||||
Route::post('user/login', [LoginController::class, 'login'])->name('user.login');
|
||||
Route::post('webauthn/login', [WebAuthnLoginController::class, 'login'])->name('webauthn.login');
|
||||
});
|
||||
|
||||
@ -44,15 +53,15 @@
|
||||
* Routes protected by an authentication guard but rejected when reverse-proxy guard is enabled
|
||||
*/
|
||||
Route::group(['middleware' => ['behind-auth', 'rejectIfReverseProxy']], function () {
|
||||
Route::put('user', 'Auth\UserController@update')->name('user.update');
|
||||
Route::patch('user/password', 'Auth\PasswordController@update')->name('user.password.update')->middleware('rejectIfDemoMode');
|
||||
Route::get('user/logout', 'Auth\LoginController@logout')->name('user.logout');
|
||||
Route::delete('user', 'Auth\UserController@delete')->name('user.delete')->middleware('rejectIfDemoMode');
|
||||
Route::put('user', [UserController::class, 'update'])->name('user.update');
|
||||
Route::patch('user/password', [PasswordController::class, 'update'])->name('user.password.update')->middleware('rejectIfDemoMode');
|
||||
Route::get('user/logout', [LoginController::class, 'logout'])->name('user.logout');
|
||||
Route::delete('user', [UserController::class, 'delete'])->name('user.delete')->middleware('rejectIfDemoMode');
|
||||
|
||||
Route::get('oauth/personal-access-tokens', [PersonalAccessTokenController::class, 'forUser'])->name('passport.personal.tokens.index');
|
||||
Route::post('oauth/personal-access-tokens', [PersonalAccessTokenController::class, 'store'])->name('passport.personal.tokens.store');
|
||||
Route::delete('oauth/personal-access-tokens/{token_id}', [PersonalAccessTokenController::class, 'destroy'])->name('passport.personal.tokens.destroy');
|
||||
|
||||
Route::get('oauth/personal-access-tokens', '\Laravel\Passport\Http\Controllers\PersonalAccessTokenController@forUser')->name('passport.personal.tokens.index');
|
||||
Route::post('oauth/personal-access-tokens', '\Laravel\Passport\Http\Controllers\PersonalAccessTokenController@store')->name('passport.personal.tokens.store');
|
||||
Route::delete('oauth/personal-access-tokens/{token_id}', '\Laravel\Passport\Http\Controllers\PersonalAccessTokenController@destroy')->name('passport.personal.tokens.destroy');
|
||||
|
||||
Route::post('webauthn/register/options', [WebAuthnRegisterController::class, 'options'])->name('webauthn.register.options');
|
||||
Route::post('webauthn/register', [WebAuthnRegisterController::class, 'register'])->name('webauthn.register');
|
||||
Route::get('webauthn/credentials', [WebAuthnManageController::class, 'index'])->name('webauthn.credentials.index');
|
||||
@ -60,13 +69,14 @@
|
||||
Route::delete('webauthn/credentials/{credential}', [WebAuthnManageController::class, 'delete'])->name('webauthn.credentials.delete');
|
||||
});
|
||||
|
||||
Route::get('refresh-csrf', function(){
|
||||
Route::get('refresh-csrf', function () {
|
||||
return csrf_token();
|
||||
});
|
||||
Route::get('infos', 'SystemController@infos')->name('system.infos');
|
||||
Route::get('latestRelease', 'SystemController@latestRelease')->name('system.latestRelease');
|
||||
|
||||
Route::get('infos', [SystemController::class, 'infos'])->name('system.infos');
|
||||
Route::get('latestRelease', [SystemController::class, 'latestRelease'])->name('system.latestRelease');
|
||||
|
||||
/**
|
||||
* Route for the main landing view
|
||||
*/
|
||||
Route::get('/{any}', 'SinglePageController@index')->where('any', '.*')->name('landing');
|
||||
Route::get('/{any}', [SinglePageController::class, 'index'])->where('any', '.*')->name('landing');
|
||||
|
Loading…
Reference in New Issue
Block a user