Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
webform
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
webform
Merge requests
!423
Respect Captcha module IP allow list
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Respect Captcha module IP allow list
issue/webform-3436030:3436030-webform-captcha-elements
into
6.2.x
Overview
0
Commits
4
Pipelines
5
Changes
1
Merged
Respect Captcha module IP allow list
cilefen
requested to merge
issue/webform-3436030:3436030-webform-captcha-elements
into
6.2.x
Mar 26, 2024
Overview
0
Commits
4
Pipelines
5
Changes
1
Closes
#3436030
0
0
Merge request reports
Compare
6.2.x
version 4
9485f781
Apr 4, 2024
version 3
1f1eb684
Mar 26, 2024
version 2
279f4271
Mar 26, 2024
version 1
7a3271ce
Mar 26, 2024
6.2.x (base)
and
latest version
latest version
69b5fb9e
4 commits,
Apr 4, 2024
version 4
9485f781
4 commits,
Apr 4, 2024
version 3
1f1eb684
3 commits,
Mar 26, 2024
version 2
279f4271
2 commits,
Mar 26, 2024
version 1
7a3271ce
1 commit,
Mar 26, 2024
1 file
+
8
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/Plugin/WebformElement/Captcha.php
+
8
−
0
View file @ 69b5fb9e
Edit in single-file editor
Open in Web IDE
Show full file
@@ -100,6 +100,14 @@ class Captcha extends WebformElementBase {
$element
[
'#captcha_admin_mode'
]
=
TRUE
;
}
// Hide and solve the element if the user is exempt by IP address.
$is_exempt
=
function_exists
(
'captcha_whitelist_ip_whitelisted'
)
&&
captcha_whitelist_ip_whitelisted
();
if
(
$is_exempt
)
{
$element
[
'#access'
]
=
FALSE
;
$element
[
'#captcha_admin_mode'
]
=
TRUE
;
}
// Always enable admin mode for test.
$is_test
=
(
strpos
(
$this
->
routeMatch
->
getRouteName
(),
'.webform.test_form'
)
!==
FALSE
)
?
TRUE
:
FALSE
;
if
(
$is_test
)
{
Loading