Add configurable role management, expanded project permission coverage, secured module routes, and single-active-session enforcement with online user administration.
21 lines
496 B
PHP
21 lines
496 B
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
class AuthSession extends BaseController
|
|
{
|
|
public function status()
|
|
{
|
|
if (! function_exists('auth') || ! auth()->loggedIn()) {
|
|
return $this->response->setStatusCode(401)->setJSON([
|
|
'active' => false,
|
|
'login_url' => base_url('login'),
|
|
]);
|
|
}
|
|
|
|
return $this->response->setJSON([
|
|
'active' => true,
|
|
'checked_at' => date('Y-m-d H:i:s'),
|
|
]);
|
|
}
|
|
} |