update: quotations section is not protected by middleware

This commit is contained in:
saparatayev 2023-03-11 20:55:02 +05:00
parent e46ec4fe8c
commit 9ed58f778c
7 changed files with 66 additions and 8 deletions

View File

@ -53,4 +53,15 @@ class HomeController extends Controller
{ {
return view('logout'); return view('logout');
} }
/**
* Redirect to a definite resource, if no access
*/
public function needAuthFirst()
{
return Inertia::render('NeedAuthFirst', [
'text' => settings('text')[app()->getLocale()],
'parent_app' => env('PARENT_APP')
]);
}
} }

View File

@ -34,16 +34,16 @@ class CheckOctoberSession
$user = BirzhaUser::find($userId); $user = BirzhaUser::find($userId);
if(is_null($user)) { if(is_null($user)) {
return redirect()->away(env('PARENT_APP')); return redirect()->route('need_auth_first');
} else { } else {
return $next($request); return $next($request);
} }
} else { } else {
return redirect()->away(env('PARENT_APP')); return redirect()->route('need_auth_first');
} }
} catch(Throwable $th) { } catch(Throwable $th) {
\Log::info($th); \Log::info($th);
return redirect()->away(env('PARENT_APP')); return redirect()->route('need_auth_first');
} }
} }

View File

@ -0,0 +1,43 @@
<template>
<div>
<!-- Header -->
<div
class="flex bg-white p-4 text-lg border-b border-gray-300 h-20 items-center"
>
<div class="block text-base text-gray-700 font-semibold max-w-2xl">
{{ text }}
</div>
</div>
<!-- Main -->
<div class="flex flex-col items-center message">
<img :src="url('/logo.svg')" title="Logo"/>
<p>{{ trans('Auth need') }}</p><a :href="parent_app">{{ trans('Login') }}</a>
</div>
</div>
</template>
<script>
export default {
props: [
"text",
"parent_app"
],
data: function() { return { } }
};
</script>
<style scoped>
.message img {
margin: 64px 0;
}
.message p, .message a {
font-size: 29px;
color: #003197;
}
.message a {
text-decoration: underline;
font-size: 20px;
}
</style>

View File

@ -72,5 +72,6 @@
"Unauthorized": "Unauthorized", "Unauthorized": "Unauthorized",
"Seller country": "Seller country", "Seller country": "Seller country",
"Buyer country": "Buyer country", "Buyer country": "Buyer country",
"Trading": "Trading results" "Trading": "Trading results",
"Auth need": "Please login first."
} }

View File

@ -72,5 +72,6 @@
"Unauthorized": "Неверные данные", "Unauthorized": "Неверные данные",
"Seller country": "Страна продавца", "Seller country": "Страна продавца",
"Buyer country": "Страна покупателя", "Buyer country": "Страна покупателя",
"Trading": "Итоги торгов" "Trading": "Итоги торгов",
"Auth need": "Необходимо войти в систему."
} }

View File

@ -72,5 +72,6 @@
"Unauthorized": "Nädogry maglumat", "Unauthorized": "Nädogry maglumat",
"Seller country": "Satyjynyň yurdy", "Seller country": "Satyjynyň yurdy",
"Buyer country": "Alyjynyň yurdy", "Buyer country": "Alyjynyň yurdy",
"Trading": "Söwdanyň jemi" "Trading": "Söwdanyň jemi",
"Auth need": "Giriş zerur."
} }

View File

@ -24,14 +24,15 @@ use App\Http\Controllers\Admin\LocalizationController;
*/ */
// Route::get('/', [HomeController::class, 'index'])->name('home'); // Route::get('/', [HomeController::class, 'index'])->name('home');
Route::get('need-auth-first', [HomeController::class, 'needAuthFirst'])->name('need_auth_first');
Route::get('/', [ExportController::class, 'index'])->name('exports');
Route::group(['middleware' => 'check_october_session'], function () { Route::group(['middleware' => 'check_october_session'], function () {
Route::get('imports', [ImportController::class, 'index'])->name('imports'); Route::get('imports', [ImportController::class, 'index'])->name('imports');
Route::get('tradings', [TradingController::class, 'index'])->name('tradings'); Route::get('tradings', [TradingController::class, 'index'])->name('tradings');
Route::get('/', [ExportController::class, 'index'])->name('exports');
Route::get('download/{group}', [GroupController::class, 'download'])->name('download'); Route::get('download/{group}', [GroupController::class, 'download'])->name('download');
Route::post('requests', [RequestController::class, 'store'])->name('requests.store'); Route::post('requests', [RequestController::class, 'store'])->name('requests.store');
Route::get('lang/{lang}', [HomeController::class, 'lang'])->name('lang');
}); });
Route::get('lang/{lang}', [HomeController::class, 'lang'])->name('lang');
Route::group(['middleware' => 'auth:sanctum'], function () { Route::group(['middleware' => 'auth:sanctum'], function () {
Route::post('imports/import', [ImportController::class, 'import'])->name('imports.import'); Route::post('imports/import', [ImportController::class, 'import'])->name('imports.import');