shield: Bug: Missing loading helper 'auth' in ActionController
PHP Version
7.4.16
CodeIgniter4 Version
4.2.3
Shield Version
v1.0.0-beta.2
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
mysqlnd 8.1.1
Did you customize Shield?
No
What happened?
We’ve wanted to enable 2FA authentication in our application, but after enabling it in Auth.php an error occurs.
Steps to Reproduce
Enable 2FA in Auth.php with this code
public array $actions = [ 'login' => 'CodeIgniter\Shield\Authentication\Actions\Email2FA', 'register' => null, ];
After user login, system is returning error
After some reading of Shield code we’ve seen that the ActionController actually don’t load an auth helper. So that’s why Codeigniter is trying to run auth() controller, what we see on the screenshot.
Please update ActionController and change
protected $helpers = ['setting'];
to protected $helpers = ['auth', 'setting'];
Expected Output
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (17 by maintainers)
@MGatner I’ve maded a pull request by Github UI
In Common.php, developers can override the helper functions. So I sent a PR #368
Composer is required. https://github.com/codeigniter4/shield#prerequisites
Okay maybe I was wrong on which event, but same idea:
I recommend you do
2. Helper Setup
: https://github.com/codeigniter4/shield/blob/develop/docs/install.md#manual-setup