Shield validation question - 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: Shield validation question (/showthread.php?tid=82568) Pages:
1
2
|
Shield validation question - janroz - 07-25-2022 Hello, I have question about shield for codeigniter 4. I have backend with form for edit and add new users. I use it like this: PHP Code: $this->validation->setRules([ But when I submit a form, I expect to be redirected back to the form and show errors from validation. But I got CodeIgniter\Shield\Exceptions\ValidationException. I looked at sources and there is a trait for it - CheckQueryReturnTrait. How to work with it, I just want to show validator errors like usual, but this throw exception and generate error. Thank you. RE: Shield validation question - kenjis - 07-25-2022 1. What class did throw the ValidationException? 2. What is the validation error message? RE: Shield validation question - chronic - 08-14-2022 Did you find a solution? because in every controller where I use validation it gives me the same error: PHP Code: CodeIgniter\Shield\Exceptions\ValidationException RE: Shield validation question - janroz - 08-14-2022 (08-14-2022, 02:52 AM)chronic Wrote: Did you find a solution? because in every controller where I use validation it gives me the same error: Hello, yes, this problem is what I have. I have partial solution. Look at Config\Auth.php and set false the recordActiveDate variable. Then it start working. Nobody helped, maybe I overlooking something. RE: Shield validation question - chronic - 08-14-2022 Thanks janroz, disabling "recordActiveDate" actually works. But I wonder if we are the only ones with this problem, or there is something wrong with this piece of code in vendor/codeigniter4/shield/src/Authentication/Authenticators/Session.php PHP Code: /** Exactly on this line: PHP Code: $this->provider->save($this->user); RE: Shield validation question - kenjis - 08-14-2022 ValidationException shows the reason in the exception message. Why don't you fix it? RE: Shield validation question - chronic - 08-15-2022 (08-14-2022, 08:32 PM)kenjis Wrote: ValidationException shows the reason in the exception message. Sorry kenjis, but for me it is not clear what is not working, otherwise I was not asking for help here. But I have seen, how janroz suggested, that if I disable recordActiveDate in the Auth.php file everything will work again. So I would like to understand if I'm doing something wrong, where is the error, because I certainly have limits in finding it. I attach the link to the image of the error page, maybe you can help me. https://postimg.cc/LhsGSxtp Thank you RE: Shield validation question - kenjis - 08-15-2022 I cannot read, but the error message is: RE: Shield validation question - chronic - 08-15-2022 (08-15-2022, 02:20 AM)kenjis Wrote: I cannot read, but the error message is: The point is that if I disable recordActiveDate every error message is shown to me correctly at every input in the form, as in the image below: I am wrong something, and if so where can I look to understand what am I wrong? or could there be some problem with shield or with the latest update of Codeigniter 4.2.4, which I didn't have before despite recordActiveDate being true? Because to me after the update this problem occurs on all forms. RE: Shield validation question - kenjis - 08-15-2022 What do you do in the page? Can you show code? Do you know why you call the recordActiveDate() method? |