lonnieezell / Bonfire2

CodeIgniter 4-based application skeleton
MIT License
132 stars 50 forks source link

User activation is broken (fails to load master template) #330

Closed dgvirtual closed 1 year ago

dgvirtual commented 1 year ago

After a user registers and an email with a code is sent to him, the route http://localhost:8080/auth/a/show is loaded, but results in an error (log file output):

CRITICAL - 2023-05-07 15:13:31 --> Invalid file: master.php
in SYSTEMPATH/Exceptions/FrameworkException.php on line 33.
 1 SYSTEMPATH/View/View.php(201): CodeIgniter\Exceptions\FrameworkException::forInvalidFile('master.php')
 2 SYSTEMPATH/View/View.php(229): CodeIgniter\View\View->render('master', [], true)
 3 SYSTEMPATH/Common.php(1184): CodeIgniter\View\View->render('\\CodeIgniter\\Shield\\Views\\email_activate_show', [], true)
 4 VENDORPATH/codeigniter4/shield/src/Traits/Viewable.php(16): view('\\CodeIgniter\\Shield\\Views\\email_activate_show', [...], [])
 5 VENDORPATH/codeigniter4/shield/src/Authentication/Actions/EmailActivator.php(71): CodeIgniter\Shield\Authentication\Actions\EmailActivator->view('\\CodeIgniter\\Shield\\Views\\email_activate_show', [...])
 6 VENDORPATH/codeigniter4/shield/src/Controllers/ActionController.php(54): CodeIgniter\Shield\Authentication\Actions\EmailActivator->show()
 7 VENDORPATH/codeigniter4/shield/src/Controllers/ActionController.php(42): CodeIgniter\Shield\Controllers\ActionController->show()
 8 SYSTEMPATH/CodeIgniter.php(933): CodeIgniter\Shield\Controllers\ActionController->_remap('show')
 9 SYSTEMPATH/CodeIgniter.php(499): CodeIgniter\CodeIgniter->runController(Object(CodeIgniter\Shield\Controllers\ActionController))
10 SYSTEMPATH/CodeIgniter.php(368): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
11 FCPATH/index.php(67): CodeIgniter\CodeIgniter->run()
12 SYSTEMPATH/Commands/Server/rewrite.php(47): require_once('/home/dg/Programavimas/MOK/bonfire2/public/index.php')

It seems that the app is trying to load the view with a Config/Auth.php $views array key 'action_email_activate_show' which points to '\CodeIgniter\Shield\Views\email_activate_show', which in turn tries to load the master layout view in it's first line of code, again, taking the value for key 'layout' from the same config $views array: 'layout' => 'master', and then failing to find the view in question, since it is actually looking in the same directory where the email_activate_show.php file is placed.

And I have no clue how to refer to that layout, which happens to be in themes/Auth, properly :( .

dgvirtual commented 1 year ago

Upon further investigation I found that the method is just not implemented in Bonfire, since Bonfire extends every Shield controller and reimplements every method that returns a view. To get it working, one would need to extend the Shield ActionController show method, which is not the kind of controller method that I am used to. I tried and failed badly, so I gave up.