Add Captcha handling in Application

This commit is contained in:
Romain Neutron
2013-03-06 19:10:26 +01:00
parent 566512c1c7
commit a69edf7c20

View File

@@ -565,6 +565,36 @@ class Application extends SilexApplication
return $this['session']->getFlashBag()->get($type, $default);
}
/**
* Asks for a captcha ar next authentication
*
* @return Application
*/
public function requireCaptcha()
{
if ($this['phraseanet.registry']->get('GV_captchas')) {
$this['session']->add('require_captcha', true);
}
return $this;
}
/**
* Tells if a captcha is required for next authentication
*
* @return boolean
*/
public function isCaptchaRequired()
{
if ($this['session']->has('require_captcha')) {
$this['session']->remove('require_captcha');
return true;
}
return false;
}
/**
* Returns an an array of available collection for offline queries
*