Hi,
I am hoping to get some help with the Uniform plugin, and Calc guard. I think Uniform is working as is, but when I add the Calc guard, I get the following error in the Kirby CMS Debugger:
Class 'l' not found
If I reading the debugger correctly, it seems like the error is being hit on line 24 of /Users/chris/Documents/Development/lfa-bh100/vendor/mzur/kirby-uniform/src/helpers.php
when it hits:
return str::encode($a.' '.l::get('uniform-calc-plus').' '.$b);
My relevant code in the template is:
<form action="<?php echo $page->url() ?>" method="POST">
<input name="email" type="email" value="<?php echo $form->old('email'); ?>">
<textarea name="message"><?php echo $form->old('message'); ?></textarea>
<label>Please calculate <?php echo uniform_captcha() ?></label>
<?php echo captcha_field('result', 'my-class'); ?>
<?php echo csrf_field(); ?>
<?php echo honeypot_field('url', 'honeypot'); ?>
<input type="submit" value="Submit">
</form>
<?php if ($form->success()): ?>
Success!
<?php else: ?>
<?php snippet('uniform/errors', ['form' => $form]); ?>
<?php endif; ?>
and in the controller:
<?php
use Uniform\Form;
return function ($kirby)
{
$form = new Form([
'email' => [
'rules' => ['required', 'email'],
'message' => 'Please enter a valid email address',
],
'message' => [
'rules' => ['required'],
'message' => 'Please enter a message',
],
'captcha' => [
'rules' => ['required', 'num'],
'message' => 'Please fill in the anti-spam field',
],
]);
if (kirby()->request()->is('POST')) {
$form
->honeypotGuard(['field' => 'website'])
->calcGuard(['field' => 'captcha'])
->logAction([
'file' => kirby()->roots()->site().'/messages.log'
]);
}
return compact('form');
};
I’m also curious if Uniform is the best plugin for my needs. I have a form that I prevent from sending any data, but I grab the values entered to update Firebase via JS. My thought is adding Uniform will create some additional security, but I’m not sure this is the best way to do this…
Any help with both of these questions is much appreciated – thank you!