phly / PhlyContact

ZF2 module for implementing contact forms
25 stars 17 forks source link

Referer check fails after validation error #14

Open securez opened 10 years ago

securez commented 10 years ago

This also affects zf2 homepage that use this module.

After any form failed validation, if the form is send again with correct values, the referer check in ContactController->thankYouAction(), redirects to contact again.

This is annoying to users, that don't know if her message was sent.

dnsahoo commented 9 years ago

Hi,

I am getting following error while adding this contact form module.

Zend\Session\Exception\RuntimeException

File:

F:\xampp\htdocs\zf2\library\Zend\Session\SessionManager.php:111

Message:

Session validation failed

Stack trace:

#0 F:\xampp\htdocs\zf2\library\Zend\Session\AbstractContainer.php(78): Zend\Session\SessionManager->start()
#1 F:\xampp\htdocs\zf2\vendor\zendframework\zend-validator\Zend\Validator\Csrf.php(183): Zend\Session\AbstractContainer->__construct('Zend_Validator_...')
#2 F:\xampp\htdocs\zf2\vendor\zendframework\zend-validator\Zend\Validator\Csrf.php(270): Zend\Validator\Csrf->getSession()
#3 F:\xampp\htdocs\zf2\vendor\zendframework\zend-validator\Zend\Validator\Csrf.php(302): Zend\Validator\Csrf->initCsrfToken()
#4 F:\xampp\htdocs\zf2\vendor\zendframework\zend-validator\Zend\Validator\Csrf.php(222): Zend\Validator\Csrf->generateHash()
#5 F:\xampp\htdocs\zf2\vendor\zendframework\zend-form\Zend\Form\Element\Csrf.php(154): Zend\Validator\Csrf->getHash(true)
#6 F:\xampp\htdocs\zf2\vendor\zendframework\zend-form\Zend\Form\Form.php(213): Zend\Form\Element\Csrf->prepareElement(Object(PhlyContact\Form\ContactForm))
#7 F:\xampp\htdocs\zf2\module\PhlyContact\view\phly-contact\contact\index.phtml(20): Zend\Form\Form->prepare()
#8 F:\xampp\htdocs\zf2\vendor\zendframework\zend-view\Zend\View\Renderer\PhpRenderer.php(506): include('F:\xampp\htdocs...')
#9 F:\xampp\htdocs\zf2\vendor\zendframework\zend-view\Zend\View\View.php(205): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel))
#10 F:\xampp\htdocs\zf2\vendor\zendframework\zend-view\Zend\View\View.php(233): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#11 F:\xampp\htdocs\zf2\vendor\zendframework\zend-view\Zend\View\View.php(198): Zend\View\View->renderChildren(Object(Zend\View\Model\ViewModel))
#12 F:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\Zend\Mvc\View\Http\DefaultRenderingStrategy.php(103): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#13 [internal function]: Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
#14 F:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\Zend\EventManager\EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#15 F:\xampp\htdocs\zf2\vendor\zendframework\zend-eventmanager\Zend\EventManager\EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('render', Object(Zend\Mvc\MvcEvent), Array)
#16 F:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\Zend\Mvc\Application.php(352): Zend\EventManager\EventManager->trigger('render', Object(Zend\Mvc\MvcEvent))
#17 F:\xampp\htdocs\zf2\vendor\zendframework\zend-mvc\Zend\Mvc\Application.php(327): Zend\Mvc\Application->completeRequest(Object(Zend\Mvc\MvcEvent))
#18 F:\xampp\htdocs\zf2\public\index.php(17): Zend\Mvc\Application->run()
#19 {main}

Thanks & Regards, Dhirendra