fix enrollment logic, add financial aid, fix class distribution
Tests / PHPUnit (push) Failing after 1m6s
Tests / PHPUnit (push) Failing after 1m6s
This commit is contained in:
@@ -252,6 +252,32 @@ class AuthController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
public function adminAuthMe()
|
||||
{
|
||||
if (! session()->get('is_logged_in')) {
|
||||
return $this->response->setStatusCode(401)->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Unauthenticated.',
|
||||
]);
|
||||
}
|
||||
|
||||
$userId = (int) session()->get('user_id');
|
||||
$roles = array_values(array_filter((array) (session()->get('roles') ?? [])));
|
||||
$activeRole = session()->get('role');
|
||||
|
||||
return $this->response->setJSON([
|
||||
'status' => true,
|
||||
'user' => [
|
||||
'id' => $userId,
|
||||
'email' => session()->get('user_email'),
|
||||
'name' => session()->get('user_name'),
|
||||
'type' => session()->get('user_type'),
|
||||
'roles' => $roles,
|
||||
'role' => $activeRole,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* API Registration endpoint
|
||||
* POST /api/v1/register
|
||||
@@ -552,6 +578,7 @@ class AuthController extends BaseController
|
||||
|
||||
$roleNames = array_column($roles, 'name');
|
||||
|
||||
session()->regenerate(true);
|
||||
session()->set([
|
||||
'user_id' => $user['id'],
|
||||
'user_email' => $user['email'],
|
||||
@@ -565,8 +592,6 @@ class AuthController extends BaseController
|
||||
'school_year' => $this->schoolYear,
|
||||
]);
|
||||
$this->applyStylePreferences((int) $user['id']);
|
||||
log_message('debug', 'Session after login: ' . print_r(session()->get(), true));
|
||||
//dd('Login successful. Roles:', $roleNames, session()->get());
|
||||
|
||||
if (count($roleNames) === 1) {
|
||||
// One role → set and redirect directly
|
||||
|
||||
Reference in New Issue
Block a user