Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
captcha
Commits
83f4bbc2
Commit
83f4bbc2
authored
Aug 19, 2018
by
elachlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2992697
by elachlan: Testing failing on 8.x Branch
parent
294c1a23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
14 deletions
+2
-14
captcha.module
captcha.module
+1
-8
src/Element/Captcha.php
src/Element/Captcha.php
+1
-6
No files found.
captcha.module
View file @
83f4bbc2
...
...
@@ -418,16 +418,9 @@ function _captcha_get_posted_captcha_info(array $element, FormStateInterface $fo
'@posted_captcha_token'
=>
var_export
(
$posted_captcha_token
,
TRUE
),
]
);
// Invalidate the CAPTCHA session.
$posted_captcha_sid
=
NULL
;
}
// Invalidate CAPTCHA token to avoid reuse.
if
(
!
empty
(
$posted_captcha_sid
))
{
\
Drupal
::
database
()
->
update
(
'captcha_sessions'
)
->
fields
([
'token'
=>
NULL
])
->
condition
(
'csid'
,
$posted_captcha_sid
)
->
execute
();
}
}
}
else
{
...
...
src/Element/Captcha.php
View file @
83f4bbc2
...
...
@@ -129,12 +129,7 @@ class Captcha extends FormElement implements ContainerFactoryPluginInterface {
'#value'
=>
$captcha_sid
,
];
// Additional one time CAPTCHA token: store in database and send with form.
// $captcha_token = hash('sha256', mt_rand());
// db_update('captcha_sessions')
// ->fields(['token' => $captcha_token])
// ->condition('csid', $captcha_sid)
// ->execute();
// Store CAPTCHA token as hidden field.
$captcha_token
=
\
Drupal
::
database
()
->
select
(
'captcha_sessions'
,
'cs'
)
->
fields
(
'cs'
,
[
'token'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment