By Greg Nowak. Updated 18 November 2026.
A login screen can look finished while account recovery still leaves customers stranded. A delayed email, an exposed download route, or a password change that leaves other sessions active can turn a routine task into a support problem.
For a business owner or agency maintaining a live CodeIgniter application, start with three decisions: what needs protecting, how users recover access, and how to introduce changes without locking out existing accounts. Those decisions should shape the implementation.
Start with the application you have
Before replacing authentication code, map user records, password hashes, permissions, sessions, and private routes. Include background integrations and mobile clients. This gives the developer a migration scope and gives the business a clearer release plan.
| Current application | Sensible next step | Check before release |
|---|---|---|
| CodeIgniter 4 with custom authentication | Assess a move to Shield | Existing accounts, password compatibility, and permissions |
| CodeIgniter 4 already using Shield | Review configuration and recovery behavior | Route filters, email delivery, and session handling |
| CodeIgniter 3 or another older implementation | Fix immediate exposure and plan the upgrade separately | Private endpoints and reset-token handling |
Does “forgot password” mean login or reset?
Shield’s built-in recovery experience sends a one-time link that logs the user in. It does not automatically require a new password. Decide whether that behavior meets your account policy before writing customer instructions.
Magic links last one hour by default, configurable through $magicLinkLifetime in app/Config/Auth.php. After successful completion, Shield exposes a temporary magicLogin session value for five minutes. You can use it to redirect someone to password settings. A mandatory password change needs an enforced account state and route restrictions; a temporary redirect flag alone cannot guarantee completion.
Test recovery with any configured second authentication step and through customers’ email systems. Shield includes bot detection, but automated link visits can still cause trouble with one-time links. An expired-link message should explain how to request another email.
If policy requires choosing a new password before normal access, implement a dedicated reset flow. Follow OWASP’s recovery guidance:
- Return the same public message for known and unknown accounts, with reasonably consistent response times.
- Limit repeated requests, including requests targeting one account.
- Use securely generated, securely stored, expiring, single-use tokens.
- Build HTTPS reset URLs from a trusted application address, never an unchecked Host header.
- After resetting, notify the user, require normal login, and offer or enforce invalidation of existing sessions.
For suspected compromise, also review recovery details and authentication methods, and invalidate outstanding recovery links. Changing the password alone may leave an attacker with access.
Set up Shield away from production first
For a compatible CodeIgniter 4 application, use Shield’s installation procedure as the starting point. Run these commands in development or staging:
composer require codeigniter4/shield
php spark shield:setupConfirm that the authentication routes are registered once in app/Config/Routes.php:
service('auth')->routes($routes);Review configuration and database migrations before applying them to existing account data. Setup does not migrate custom users and permissions for you. Keep a database backup and a rollback plan.
For session authentication, configure session-based CSRF protection and verify that the CSRF filter protects forms. Configure app/Config/Email.php with the real sender and transport. Also decide whether public registration belongs in the application; an internal operations tool may need invitation-only accounts.
Protect actions as well as pages
Apply Shield’s session filter consistently to private web routes. Then check permissions: being logged in should not automatically grant access to another customer’s records or administrative actions. Review API authentication separately.
Shield’s controller filters documentation recommends auth-rates for authentication endpoints. Merge this entry into the existing $filters configuration in app/Config/Filters.php:
'auth-rates' => [
'before' => ['login*', 'register', 'auth/*'],
],Match the patterns to your actual URLs, including prefixes and custom recovery endpoints. If you enforce password changes with force-reset, exempt authentication and password-change routes as required to avoid redirect loops.
Test downloads, exports, and administrative requests directly while logged out and as a lower-privilege user. Hiding a navigation link does not protect its endpoint.
Validate login input without rejecting existing passwords
For custom controllers, the CodeIgniter validation guide supports validating explicit input and using only validated values. This example requires CodeIgniter 4.4 or later for getValidated():
$rules = [
'email' => 'required|max_length[254]|valid_email',
'password' => 'required',
];
$data = $this->request->getPost(array_keys($rules));
if (! $this->validateData($data, $rules)) {
return view('auth/login', [
'errors' => $this->validator->getErrors(),
]);
}
$credentials = $this->validator->getValidated();This prepares credentials; authentication still needs to follow. Apply new password-strength rules at registration or password change. Adding a stronger minimum at login can reject an existing password before authentication. Set length limits deliberately around the supported hashing implementation and existing accounts.
Release the account workflow, including support
Before launch, test failed attempts, throttling, logout, session expiry, remembered sessions, unknown addresses, expired links, and link reuse. Check recovery after an email address changes. Verify delivery through production mail infrastructure and keep passwords and recovery tokens out of logs.
Give support staff a short procedure for delayed email, deactivated accounts, and users who have lost mailbox access. Assign an owner for delivery failures and agree what evidence is needed before manually restoring access.
If you need help deciding what to fix first, talk to Greg about your CodeIgniter application. A focused review can define the immediate fixes, migration dependencies, and release checks your team needs.
Related on GrN.dk
- Locked Out of Your Apple Developer Account? Fix Access Before October 1
- Apache 2.4.68: What to Check Before You Call It Patched
- Drupal 7 on MySQL 8: How to Fix the NO_AUTO_CREATE_USER Error
Need help with this kind of work?
Discuss your CodeIgniter login and recovery flow Get in touch with Greg.