remove codeigniter
This commit is contained in:
@@ -11,8 +11,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Mirrors CodeIgniter `AuthController::apiLogin` security behavior:
|
||||
* IP lockout (ip_attempts), failed_attempts / suspension after 3 failures, login_activity logging.
|
||||
* Centralizes API login lockout, suspension, and audit logging behavior.
|
||||
*/
|
||||
class ApiLoginSecurityService
|
||||
{
|
||||
@@ -79,7 +78,7 @@ class ApiLoginSecurityService
|
||||
|
||||
if ($failedAttempts >= 3) {
|
||||
$data['is_suspended'] = true;
|
||||
// CI sends reset email via View\UserController::sendResetEmail — wire Laravel mail here when parity is needed.
|
||||
// Password-reset delivery can be wired here when the suspension workflow is finalized.
|
||||
Log::notice('api_login: account suspended after failed attempts', ['email' => $email, 'user_id' => $user->id]);
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ class ApiLoginSecurityService
|
||||
}
|
||||
|
||||
/**
|
||||
* CI returns roles as an object map {"RoleName": true}.
|
||||
* Returns roles as an object map {"RoleName": true}.
|
||||
*
|
||||
* @param list<string> $roleNames
|
||||
*/
|
||||
@@ -128,13 +127,13 @@ class ApiLoginSecurityService
|
||||
}
|
||||
|
||||
/**
|
||||
* Top-level JSON body aligned with the CodeIgniter 4 `AuthController::apiLogin` success payload.
|
||||
* Top-level JSON body for API login success responses.
|
||||
*
|
||||
* @return array{status: true, token: string, user: array{id: int, name: string, roles: object, class_section_id: ?int, class_section_name: ?string}}
|
||||
*/
|
||||
public function buildLoginResponse(User $user, string $jwtToken): array
|
||||
{
|
||||
$roleNames = $user->roleNamesLikeCodeIgniter();
|
||||
$roleNames = $user->roleNames();
|
||||
$fullName = trim(($user->firstname ?? '').' '.($user->lastname ?? ''));
|
||||
$teacherContext = $user->teacherSessionContext();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user