CodeIgniter Forums
Bonfire 2: problems creating a new user - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34)
+--- Thread: Bonfire 2: problems creating a new user (/showthread.php?tid=87034)



Bonfire 2: problems creating a new user - Tbronson - 03-08-2023

Can't create a new user with "New User" button in Bonfire admin, or using the registration form.

Bonfire 2 in CI 4.3.2. Clicking through the admin area, everything seems to be working fine. There is one user, the original SuperAdmin.

1. When I click the "New User" button (https://mysite.com/admin/users/new) I get this error:

CodeIgniter\Shield\Exceptions\LogicException
"$user->id" is null. You should not use the incomplete User object.
VENDORPATH/codeigniter4/shield/src/Models/UserIdentityModel.php at line 85

2. When I submit the completed reg form from https://mysite.com/register, the site home page comes up with the url mysite.com/index.php.

When there's a proper password (4 green bars), it goes to the home page and the browser's "Save this password" box pops up.
When the password doesn't pass (2 orange bars), it goes straight to the home page.

No new record appears in the "users" db table.

User settings are

- "Allow users to register..."
- "User" group for new user
- "Allow remember" set to 1 week
- min pwd length 8
- Composition, Nothing Personal, Dictionary validators checked.

Thanks!


RE: Bonfire 2: problems creating a new user - Tbronson - 03-13-2023

Did a completely fresh install of CI4 and Bonfire 2 and got the same results as above.


RE: Bonfire 2: problems creating a new user - kilishan - 03-13-2023

Please try updating to the latest version of Bonfire. I just merged some changes that should fix that.


RE: Bonfire 2: problems creating a new user - Tbronson - 03-14-2023

Cool! How do you upgrade?


RE: Bonfire 2: problems creating a new user - kilishan - 03-14-2023

Just do a
PHP Code:
composer update 
.


RE: Bonfire 2: problems creating a new user - Tbronson - 03-14-2023

Thanks! That seems to work.

Successfully created new user in admin, and by registration form. Logged in with both, changed groups, everything fine so far.

One thing. Trying to log in again to a user when the user is already logged in gets this:

Code:
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: 1
VENDORPATH/codeigniter4/shield/src/Authentication/Authenticators/Session.php at line 655



RE: Bonfire 2: problems creating a new user - kilishan - 03-15-2023

Ah, that is a new change in Shield that I forgot to account for in Bonfire. Will get to that soon, unless someone beats me with a PR Smile