anselmh / kirby-uniform-turnstile Goto Github PK
View Code? Open in Web Editor NEWA Kirby 3 plugin implementing a Cloudflare Turnstile guard for the Uniform plugin.
License: MIT License
A Kirby 3 plugin implementing a Cloudflare Turnstile guard for the Uniform plugin.
License: MIT License
I am getting the error 'Class "Uniform\Guards\Guard" not found'
Line 8 of src/Guards/TurnstileGuard.php:
class TurnstileGuard extends Guard
Manual install to remote server running php 8.0.28
Have followed instructions but get 'Call to undefined function turnstileField()'.
Plugin installed in plugins/kirby-uniform-turnstile
Template:
`
<div class="row">
<?php if ($form->success()): ?>
<div class="col-lg-12 alert alert-success">
Thank you for your message. A member of our team will be in touch shortly to discuss your enquiry.
</div>
<?php else: ?>
<div class="col-lg-12">
<?php snippet('uniform/errors', ['form' => $form]) ?>
</div>
<?php endif; ?>
<div class="form-group col-lg-4">
<label>First Name</label>
<input<?php if ($form->error('firstName')): ?> class="error" <?php endif; ?> name="firstName" type="text"
value="<?php echo $form->old('firstName') ?>" required>
</div>
<div class="form-group col-lg-4">
<label>Last Name</label>
<input<?php if ($form->error('lastName')): ?> class="error" <?php endif; ?> name="lastName" type="text"
value="<?php echo $form->old('lastName') ?>" required>
</div>
<div class="form-group col-lg-4">
<label>Company</label>
<input<?php if ($form->error('company')): ?> class="error" <?php endif; ?> name="company" type="text"
value="<?php echo $form->old('company') ?>" required>
</div>
<div class="form-group col-lg-4">
<label>Post Code</label>
<input<?php if ($form->error('postCode')): ?> class="error" <?php endif; ?> name="postCode" type="text"
value="<?php echo $form->old('postCode') ?>" required>
</div>
<div class="form-group col-lg-4">
<label>Email Address</label>
<input name="customerEmail" type="email" value="<?php echo $form->old('customerEmail') ?>" required>
</div>
<div class="form-group col-lg-4">
<label>Phone Number</label>
<input<?php if ($form->error('phone')): ?> class="error" <?php endif; ?> name="phone" type="telephone"
value="<?php echo $form->old('phone') ?>" required>
</div>
<div class="form-group col-lg-12">
<label>Message</label>
<textarea<?php if ($form->error('message')): ?> class="error" <?php endif; ?> name="message" rows="7"><?php echo $form->old('message') ?></textarea>
</div>
<?php echo csrf_field() ?>
<?= turnstileField() ?>
<div class="form-group col-lg-12 font-serif fw-300 py-3">
All fields required. We do not share your data with 3rd parties. <a href="<?= $site->url()?>/privacy-policy" title="privacy policy">Privacy Policy</a>.
</div>
<div class="form-group col-lg-12">
<input type="submit" value="Send" id="submit-btn" class="button dark rbl-bg-primary chevron">
</div>
</div>
Controller:
`<?php
use Uniform\Form;
return function ($kirby)
{
$form = new Form([
'firstName' => [],
'lastName' => [],
'customerEmail' => [],
'postCode' => [],
'phone' => [],
'company' => [],
'message' => [
'rules' => ['required'],
'message' => 'Please enter a message',
],
]);
if ($kirby->request()->is('POST')) {
$form->turnstileGuard()
->emailAction([
'to' => '[email protected]',
'from' => '[email protected]',
'subject' => 'Web Enquiry',
'template' => 'web-form',
]);
}
if (r::is('POST')) {
$form->logAction([
'file' => kirby()->roots()->site().'/messages.log',
]);
}
return compact('form');
};`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.