Skip to content
Snippets Groups Projects
Commit ad2d40c5 authored by olli's avatar olli Committed by soxofaan
Browse files

Issue #2021759: When user submits a correct answer, captcha module stores in...

Issue #2021759: When user submits a correct answer, captcha module stores in session unconditionally, disabling page cache unnecessarily
parent ad165d10
No related branches found
No related tags found
No related merge requests found
......@@ -599,7 +599,13 @@ function captcha_validate($element, &$form_state) {
// we also provide the CAPTCHA $element and $form_state arrays for more advanced use cases.
if ($captcha_validate($solution, $captcha_response, $element, $form_state)) {
// Correct answer.
$_SESSION['captcha_success_form_ids'][$form_id] = $form_id;
// Store form_id in session (but only if it is useful to do so, avoid setting stuff in session unnecessarily).
$captcha_persistence = variable_get('captcha_persistence', CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_INSTANCE);
if ($captcha_persistence == CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL || $captcha_persistence == CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_TYPE) {
$_SESSION['captcha_success_form_ids'][$form_id] = $form_id;
}
// Record success.
db_update('captcha_sessions')
->condition('csid', $csid)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment