Keep on getting error about max_byte - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Keep on getting error about max_byte (/showthread.php?tid=91465) |
Keep on getting error about max_byte - Fabio-Zeus-Soft - 08-14-2024 Hi everyone and thanks in advance, I'm working with CodeIgniter 4 and Shield, but every time I try to use max_byte rule I get this error: PHP Code: CodeIgniter\Validation\Exceptions\ValidationException This is happening on Login, where I'm using the config suggested in Shield documentation: PHP Code: public $login = [ RE: Keep on getting error about max_byte - JustJohnQ - 08-14-2024 max_byte validation is part of \shield\Authentication\Passwords\ValidationRules.php. If you look at the comments in \shield\Authentication\Passwords\ValidationRules.php, it states that if you want to use that class you have to add it to Config/Validation.php in the $rulesets array. Modify the config/Validation.php file like this (according to ChatGPT): PHP Code: <?php RE: Keep on getting error about max_byte - datamweb - 08-14-2024 Hi ,Try : PHP Code: use CodeIgniter\Shield\Authentication\Passwords; RE: Keep on getting error about max_byte - Fabio-Zeus-Soft - 08-16-2024 @JustJohnQ 's reply worked, but I added PHP Code: use CodeIgniter\Shield\Authentication\Passwords\ValidationRules; I cannot find it from github, but do not you think that it would be better to add this rule to the ruleset by default since max_byte is already present in the login rules? Thanks you guys! RE: Keep on getting error about max_byte - JustJohnQ - 08-16-2024 Glad to be of assistance, please mark as solved if you consider it closed. RE: Keep on getting error about max_byte - kenjis - 08-16-2024 (08-16-2024, 07:20 AM)Fabio-Zeus-Soft Wrote: I cannot find it from github, but do not you think that it would be better to add this rule to the ruleset by default since max_byte is already present in the login rules? The "CodeIgniter\Shield\Authentication\Passwords\ValidationRules" is added by Registrar. See - https://github.com/codeigniter4/shield/blob/develop/src/Config/Registrar.php - https://www.codeigniter.com/user_guide/general/configuration.html#registrars So by default, you don't need to add it manually. But if you disable Auto-Discovery of registrars, you need to add the rule manually. See - https://www.codeigniter.com/user_guide/general/modules.html#auto-discovery |