Commit e8ea6872 authored by elachlan's avatar elachlan

#2474959, #2992697 Fix for failing test

parent eec2e2d2
...@@ -421,11 +421,13 @@ function _captcha_get_posted_captcha_info(array $element, FormStateInterface $fo ...@@ -421,11 +421,13 @@ function _captcha_get_posted_captcha_info(array $element, FormStateInterface $fo
$posted_captcha_sid = NULL; $posted_captcha_sid = NULL;
} }
// Invalidate CAPTCHA token to avoid reuse. // Invalidate CAPTCHA token to avoid reuse when the form is submitted.
\Drupal::database()->update('captcha_sessions') if (!empty($form_state['submitted']) && !empty($posted_captcha_sid)) {
->fields(['token' => NULL]) \Drupal::database()->update('captcha_sessions')
->condition('csid', $posted_captcha_sid) ->fields(['token' => NULL])
->execute(); ->condition('csid', $posted_captcha_sid)
->execute();
}
} }
} }
else { else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment