Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Userforms 3.x #2

Open
tazzydemon opened this issue Dec 3, 2015 · 5 comments
Open

Fix for Userforms 3.x #2

tazzydemon opened this issue Dec 3, 2015 · 5 comments

Comments

@tazzydemon
Copy link

Something has changed in the object flow in the current Framework 3.2 / UserForms 3.x combination.

$this inside the HoneypotField object during validation now contains no references to the current controller. $this->value is null and before that this line (26) baulks:

$timestamp = $this->getForm()->getController()->getRequest()->postVar($this->getName() . '_Timestamp');

I propose a change thus:

       $honeypot = \Controller::curr()->getRequest()->postVar($this->getName());
       $timestamp = \Controller::curr()->getRequest()->postVar($this->getName() . '_Timestamp');

L42 if (!empty($honeypot) || ($timeLimit > 0 && ($timestamp + $timeLimit) > time())) {

This change makes UserForms 3 work. YMMV. Note that any error messages displayed are not the ones created here. This is down to Userforms and I will try to fix it.

@nedmas
Copy link
Contributor

nedmas commented Dec 17, 2015

Hi @tazzydemon thanks for the issue report. This seems like it might actually be a bug with Userforms bypassing the validation method? Although your suggestion works around the issue you've highlighted it bypasses FormField::setValue() which could cause unexpected behaviour in other integrations, what do you think?

@tazzydemon
Copy link
Author

I was about to deploy as it seemed close to stable but the latest change to UserForms has chucked the baby out with the bathwater so to speak. I think that my modifications are still valid - the problem now is that the entire method of validation may (probably will) need a rework so I'm hanging fire.

@purplespider
Copy link

Is Honeypot still not working in the latest Userforms?

@tazzydemon
Copy link
Author

tazzydemon commented Mar 28, 2018 via email

@purplespider
Copy link

Please! :) Can't seem to see a fork in your account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants