Refactor admin authentication and routing***
***Add redirect for non-cloud users and instance admins without admin token.*** ***Always include admin route, regardless of cloud status.
This commit is contained in:
parent
9350fb4b97
commit
7e7f322e21
@ -11,7 +11,10 @@ class Index extends Component
|
||||
public $users = [];
|
||||
public function mount()
|
||||
{
|
||||
if (auth()->user()->id !== 0) {
|
||||
if (!isCloud()) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
if (!isInstanceAdmin() && session('adminToken') === null) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->users = User::whereHas('teams', function ($query) {
|
||||
|
@ -79,9 +79,7 @@
|
||||
if (isDev()) {
|
||||
Route::get('/dev/compose', Compose::class)->name('dev.compose');
|
||||
}
|
||||
if (isCloud()) {
|
||||
Route::get('/admin', AdminIndex::class)->name('admin.index');
|
||||
}
|
||||
Route::get('/admin', AdminIndex::class)->name('admin.index');
|
||||
|
||||
Route::post('/forgot-password', [Controller::class, 'forgot_password'])->name('password.forgot');
|
||||
Route::get('/api/v1/test/realtime', [Controller::class, 'realtime_test'])->middleware('auth');
|
||||
|
Loading…
Reference in New Issue
Block a user