function anonymous_token_validate_anon_token in Anonymous CSRF Token 7
1 string reference to 'anonymous_token_validate_anon_token'
File
- ./
anonymous_token.module, line 22
Code
function anonymous_token_validate_anon_token($form, &$form_state) {
$token = '';
if (isset($form_state['values']['anon_token'])) {
$token = $form_state['values']['anon_token'];
}
if (!drupal_valid_token($token)) {
// not a valid token!
$path = current_path();
$query = drupal_get_query_parameters();
$url = url($path, array(
'query' => $query,
));
// Setting this error will cause the form to fail validation.
form_set_error('form_token', t('The form has become outdated. Copy any unsaved work in the form below and then <a href="@link">reload this page</a>.', array(
'@link' => $url,
)));
}
}