• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

codeigniter4 / shield / 16223677872

11 Jul 2025 03:25PM UTC coverage: 92.823% (-0.03%) from 92.855%
16223677872

push

github

web-flow
Merge pull request #1274 from paulbalandan/test-nothing-personal

test: refactor `NothingPersonalValidatorTest`

2897 of 3121 relevant lines covered (92.82%)

127.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/Filters/ForcePasswordResetFilter.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * This file is part of CodeIgniter Shield.
7
 *
8
 * (c) CodeIgniter Foundation <admin@codeigniter.com>
9
 *
10
 * For the full copyright and license information, please view
11
 * the LICENSE file that was distributed with this source code.
12
 */
13

14
namespace CodeIgniter\Shield\Filters;
15

16
use CodeIgniter\Filters\FilterInterface;
17
use CodeIgniter\HTTP\IncomingRequest;
18
use CodeIgniter\HTTP\RedirectResponse;
19
use CodeIgniter\HTTP\RequestInterface;
20
use CodeIgniter\HTTP\ResponseInterface;
21
use CodeIgniter\Shield\Authentication\Authenticators\Session;
22

23
/**
24
 * Force Password Reset Filter.
25
 */
26
class ForcePasswordResetFilter implements FilterInterface
27
{
28
    /**
29
     * Checks if a logged in user should reset their
30
     * password, and then redirect to the appropriate
31
     * page.
32
     *
33
     * @param array|null $arguments
34
     *
35
     * @return RedirectResponse|void
36
     */
37
    public function before(RequestInterface $request, $arguments = null)
38
    {
39
        if (! $request instanceof IncomingRequest) {
5✔
40
            return;
×
41
        }
42

43
        /** @var Session $authenticator */
44
        $authenticator = auth('session')->getAuthenticator();
5✔
45

46
        if ($authenticator->loggedIn() && $authenticator->getUser()->requiresPasswordReset()) {
5✔
47
            return redirect()->to(config('Auth')->forcePasswordResetRedirect());
5✔
48
        }
49
    }
50

51
    /**
52
     * We don't have anything to do here.
53
     *
54
     * @param array|null $arguments
55
     */
56
    public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void
57
    {
58
    }
×
59
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc