shield icon indicating copy to clipboard operation
shield copied to clipboard

Bug: LogicException occurs when an unactivated user tries to log in

Open kenjis opened this issue 3 years ago • 0 comments

PHP Version

8.0.21

CodeIgniter4 Version

4.2.3

Shield Version

1.0.0-beta.2

Which operating systems have you tested for this bug?

macOS

Which server did you use?

cli-server (PHP built-in webserver)

Database

MySQL 5.7

Did you customize Shield?

No.

What happened?

CodeIgniter\Shield\Exceptions\LogicException

The user has User Info in Session, so already logged in or in pending login state. If a logged in user logs in again with other account, the session data of the previous user will be used as the new user. Fix your code to prevent users from logging in without logging out or delete the session data. user_id: 2

Steps to Reproduce

Config\Auth.php:

    public array $actions = [
        'login'    => null,
        'register' => 'CodeIgniter\Shield\Authentication\Actions\EmailActivator',
    ];
  1. Register a user.
  2. Go to the login page, and try to login.

Expected Output

At least, no Exception occurs.

Anything else?

Related #343

kenjis avatar Aug 08 '22 02:08 kenjis