PluginProbe ʕ •ᴥ•ʔ
Advanced Google reCAPTCHA / 5.40
Advanced Google reCAPTCHA v5.40
5.40 5.39 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.30 1.31 1.32 1.33 1.34 1.35
advanced-google-recaptcha / interface / tab_login_form.php
advanced-google-recaptcha / interface Last commit date
tab_activity.php 4 months ago tab_captcha.php 3 months ago tab_design.php 4 months ago tab_firewall.php 4 months ago tab_geoip.php 4 months ago tab_login_form.php 4 months ago tab_temp_access.php 4 months ago
tab_login_form.php
291 lines
1 <?php
2 /**
3 * WP Captcha
4 * https://getwpcaptcha.com/
5 * (c) WebFactory Ltd, 2022 - 2026, www.webfactoryltd.com
6 */
7
8 class WPCaptcha_Tab_Login_Form extends WPCaptcha
9 {
10 static function display()
11 {
12 $tabs[] = array('id' => 'tab_login_basic', 'class' => 'tab-content', 'label' => __('Basic', 'advanced-google-recaptcha'), 'callback' => array(__CLASS__, 'tab_basic'));
13 $tabs[] = array('id' => 'tab_login_advanced', 'class' => 'tab-content', 'label' => __('Advanced', 'advanced-google-recaptcha'), 'callback' => array(__CLASS__, 'tab_advanced'));
14 $tabs[] = array('id' => 'tab_login_tools', 'class' => 'tab-content', 'label' => __('Tools', 'advanced-google-recaptcha'), 'callback' => array(__CLASS__, 'tab_tools'));
15
16 echo '<div id="tabs_log" class="ui-tabs wpcaptcha-tabs-2nd-level">';
17 echo '<ul>';
18 foreach ($tabs as $tab) {
19 echo '<li><a href="#' . esc_attr($tab['id']) . '">' . esc_html($tab['label']) . '</a></li>';
20 }
21 echo '</ul>';
22
23 foreach ($tabs as $tab) {
24 if (is_callable($tab['callback'])) {
25 echo '<div style="display: none;" id="' . esc_attr($tab['id']) . '" class="' . esc_attr($tab['class']) . '">';
26 call_user_func($tab['callback']);
27 echo '</div>';
28 }
29 } // foreach
30
31 echo '</div>'; // second level of tabs
32
33
34 } // display
35
36 static function tab_basic()
37 {
38 $options = WPCaptcha_Setup::get_options();
39
40 echo '<table class="form-table"><tbody>';
41
42 echo '<tr valign="top">
43 <th scope="row"><label for="login_protection">Login Protection</label></th>
44 <td>';
45 WPCaptcha_Utility::create_toggle_switch('login_protection', array('saved_value' => $options['login_protection'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[login_protection]'));
46 echo '<br><span>Enable Login Protection</span>';
47 echo '</td></tr>';
48
49 echo '<tr valign="top">
50 <th scope="row"><label for="max_login_retries">Max Login Retries</label></th>
51 <td><input type="number" class="regular-text" id="max_login_retries" name="' . esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[max_login_retries]" value="' . (int)$options['max_login_retries'] . '" />';
52 echo '<span>Number of failed login attempts within the "Retry Time Period Restriction" (defined below) needed to trigger a Access Lock.</span>';
53 echo '</td></tr>';
54
55 echo '<tr valign="top">
56 <th scope="row"><label for="retries_within">Retry Time Period Restriction</label></th>
57 <td><input type="number" class="regular-text" id="retries_within" name="' . esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[retries_within]" value="' . (int)$options['retries_within'] . '" /> minutes';
58 echo '<span>Amount of time in which failed login attempts are allowed before an access lock occurs.</span>';
59 echo '</td></tr>';
60
61 echo '<tr valign="top">
62 <th scope="row"><label for="lockout_length">Access Lock Length</label></th>
63 <td><input type="number" class="regular-text" id="lockout_length" name="' . esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[lockout_length]" value="' . (int)$options['lockout_length'] . '" /> minutes';
64 echo '<span>Amount of time a particular IP will be blocked once an access lock has been triggered.</span>';
65 echo '</td></tr>';
66
67 echo '<tr valign="top">
68 <th scope="row"><label class="open-upsell open-upsell-block" for="lockout_invalid_usernames" for="lockout_invalid_usernames">Log Failed Attempts With Non-existant Usernames</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="lockout_invalid_usernames" class="open-upsell pro-label">PRO</a></th>
69 <td>';
70 echo '<div class="open-upsell open-upsell-block" data-feature="lockout_invalid_usernames">';
71 WPCaptcha_Utility::create_toggle_switch('lockout_invalid_usernames', array('saved_value' => 0, 'option_key' => ''));
72 echo '</div>';
73 echo '<span>Log failed log in attempts with non-existant usernames the same way failed attempts with bad passwords are logged.</span>';
74 echo '</td></tr>';
75
76 echo '<tr valign="top">
77 <th scope="row"><label class="open-upsell open-upsell-block" for="mask_login_errors" for="mask_login_errors">Mask Login Errors</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="mask_login_errors" class="open-upsell pro-label">PRO</a></th>
78 <td>';
79 echo '<div class="open-upsell open-upsell-block" data-feature="mask_login_errors">';
80 WPCaptcha_Utility::create_toggle_switch('mask_login_errors', array('saved_value' => 0, 'option_key' => ''));
81 echo '</div>';
82 echo '<span>Hide log in error details (such as invalid username, invalid password, invalid captcha value) to minimize data available to attackers.</span>';
83 echo '</td></tr>';
84
85 echo '<tr valign="top">
86 <th scope="row"><label class="open-upsell open-upsell-block" for="global_block" for="global_block">Block Type</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="global_block" class="open-upsell pro-label">PRO</a></th>
87 <td>';
88 echo '<div class="open-upsell open-upsell-block" data-feature="global_block">';
89 echo '<label class="wpcaptcha-radio-option">';
90 echo '<span class="radio-container"><input type="radio" id="global_block_global" value="1"><span class="radio"></span></span> Completely block website access';
91 echo '</label>';
92
93 echo '<label class="wpcaptcha-radio-option">';
94 echo '<span class="radio-container"><input type="radio" id="global_block_login" value="0" checked><span class="radio"></span></span> Only block access to the login page';
95 echo '</label>';
96 echo '</div>';
97 echo '<span>Completely block website access for blocked IPs, or just blocking access to the login page.</span>';
98 echo '</td></tr>';
99
100 echo '<tr valign="top">
101 <th scope="row"><label class="open-upsell open-upsell-block" for="block_message" for="block_message">Block Message</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="block_message" class="open-upsell pro-label">PRO</a></th>
102 <td>';
103 echo '<div class="open-upsell open-upsell-block" data-feature="block_message">';
104 echo '<input type="text" class="regular-text" id="block_message" value="" />';
105 echo '</div>';
106 echo '<span>Message displayed to visitors blocked due to too many failed login attempts. Default: <i>We\'re sorry, but your IP has been blocked due to too many recent failed login attempts.</i></span>';
107 echo '</td></tr>';
108
109 echo '<tr valign="top">
110 <th scope="row"><label class="open-upsell open-upsell-block" for="whitelist" for="whitelist">Whitelisted IPs</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="whitelist" class="open-upsell pro-label">PRO</a></th>
111 <td>';
112 echo '<div class="open-upsell open-upsell-block" data-feature="whitelist">';
113 echo '<textarea class="regular-text" id="whitelist" rows="6"></textarea>';
114 echo '</div>';
115 if(isset($_SERVER['REMOTE_ADDR'])){
116 $remote_address = sanitize_url(wp_unslash($_SERVER['REMOTE_ADDR']));
117 } else {
118 $remote_address = 'unknown';
119 }
120
121 echo '<span>List of IP addresses that will never be blocked. Enter one IP per line.<br>Your current IP is: <code>' . esc_html($remote_address) . '</code></span>';
122 echo '</td></tr>';
123
124 echo '<tr valign="top">
125 <th scope="row"><label for="show_credit_link">Show Credit Link</label></th>
126 <td>';
127 WPCaptcha_Utility::create_toggle_switch('show_credit_link', array('saved_value' => $options['show_credit_link'], 'option_key' => esc_attr(WPCAPTCHA_OPTIONS_KEY) . '[show_credit_link]'));
128 echo '<br><span>Show a small "form protected by" link below the login form to help others learn about WP Captcha and protect their sites.</span>';
129 echo '</td></tr>';
130
131 echo '<tr><td></td><td>';
132 WPCaptcha_admin::footer_save_button();
133 echo '</td></tr>';
134
135 echo '</tbody></table>';
136 }
137
138 static function tab_advanced()
139 {
140 $options = WPCaptcha_Setup::get_options();
141
142 echo '<table class="form-table"><tbody>';
143
144 if(is_multisite()){
145 echo '<div class="notice-box-info" style="border-color:#ff9f00;">WP Captcha does not support changing the Login URL for multisite installs</div>';
146 }
147
148 echo '<tr valign="top">
149 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="login_url" for="login_url">Login URL</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="login_url" class="open-upsell pro-label">PRO</a></th>
150 <td>';
151 echo '<div class="open-upsell open-upsell-block" data-feature="login_url">';
152 echo '<code>' . esc_url(home_url('/')) . '</code><input type="text" class="regular-text" style="width:160px;" id="login_url" value="" /><code>/</code>';
153 echo '</div>';
154 echo '<span>Protect your website by changing the login page URL and prevent access to the default <code>wp-login.php</code> page and the <code>wp-admin</code> path that represent the main target of most attacks. Leave empty to use default login URL.</span>';
155 echo '</td></tr>';
156
157 echo '<tr valign="top">
158 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="login_redirect_url" for="login_redirect_url">Redirect URL</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="login_redirect_url" class="open-upsell pro-label">PRO</a></th>
159 <td>';
160 echo '<div class="open-upsell open-upsell-block" data-feature="login_redirect_url">';
161 echo '<code>' . esc_url(home_url('/')) . '</code><input type="text" class="regular-text" style="width:160px;" id="login_redirect_url" value="" placeholder="404" /><code>/</code>';
162 echo '</div>';
163 echo '<span>URL where attempts to access <code>wp-login.php</code> or <code>wp-admin</code> should be redirected to. If a custom login URL is set, this defaults to <code>' . esc_url(home_url('/404/')) . '</code> unless you set it to something else.</span>';
164 echo '</td></tr>';
165
166 echo '<tr valign="top">
167 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="password_check" for="password_check">Password Check</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="password_check" class="open-upsell pro-label">PRO</a></th>
168 <td>';
169 echo '<div class="open-upsell open-upsell-block" data-feature="wpcaptcha_run_tests">';
170 echo '<button class="button button-primary button-large" style="margin-bottom:6px;">Test user passwords <i class="wpcaptcha-icon wpcaptcha-lock"></i></button>';
171 echo '</div>';
172 echo '<span>Check if any user has a weak password that is vulnerable to common brute-force dictionary attacks.</span>';
173 echo '</td></tr>';
174
175 echo '<tr valign="top">
176 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="anonymous_logging" for="anonymous_logging">Anonymous Activity Logging</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="anonymous_logging" class="open-upsell pro-label">PRO</a></th>
177 <td>';
178 echo '<div class="open-upsell open-upsell-block" data-feature="anonymous_logging">';
179 WPCaptcha_Utility::create_toggle_switch('anonymous_logging', array('saved_value' => 0, 'option_key' => ''));
180 echo '</div>';
181 echo '<span>Logging anonymously means IP addresses of your visitors are stored as hashed values. The user\'s country and user agent are still logged, but without the IP these are not considered personal data according to GDPR.</span>';
182 echo '</td></tr>';
183
184 echo '<tr valign="top">
185 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="log_passwords" for="log_passwords">Log Passwords</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="log_passwords" class="open-upsell pro-label">PRO</a></th>
186 <td>';
187 echo '<div class="open-upsell open-upsell-block" data-feature="log_passwords">';
188 WPCaptcha_Utility::create_toggle_switch('log_passwords', array('saved_value' => 0, 'option_key' => ''));
189 echo '</div>';
190 echo '<span>Enabling this option will log the passwords used in failed login attempts. This is not recommended on websites with multiple users as the passwords are logged as plain text and can be viewed by all users that have access to the WP Captcha logs or the database.</span>';
191 echo '</td></tr>';
192
193 echo '<tr valign="top">
194 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="block_bots" for="block_bots">Block Bots</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="block_bots" class="open-upsell pro-label">PRO</a></th>
195 <td>';
196 echo '<div class="open-upsell open-upsell-block" data-feature="block_bots">';
197 WPCaptcha_Utility::create_toggle_switch('block_bots', array('saved_value' => 0, 'option_key' => ''));
198 echo '</div>';
199 echo '<span>Block bots from accessing the login page and attempting to log in.</span>';
200 echo '</td></tr>';
201
202 echo '<tr valign="top">
203 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="instant_block_nonusers" for="instant_block_nonusers">Block Login Attempts With Non-existing Usernames</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="instant_block_nonusers" class="open-upsell pro-label">PRO</a></th>
204 <td>';
205 echo '<div class="open-upsell open-upsell-block" data-feature="instant_block_nonusers">';
206 WPCaptcha_Utility::create_toggle_switch('instant_block_nonusers', array('saved_value' => 0, 'option_key' => ''));
207 echo '</div>';
208 echo '<span>Immediately block IP if there is a failed login attempt with a non-existing username</span>';
209 echo '</td></tr>';
210
211 echo '<tr valign="top">
212 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="honeypot" for="honeypot">Add Honeypot for Bots</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="honeypot" class="open-upsell pro-label">PRO</a></th>
213 <td>';
214 echo '<div class="open-upsell open-upsell-block" data-feature="honeypot">';
215 WPCaptcha_Utility::create_toggle_switch('honeypot', array('saved_value' => 0, 'option_key' => ''));
216 echo '</div>';
217 echo '<span>Add a special, hidden "honeypot" field to the login form to catch and prevent bots from attempting to log in.<br>This does not affect the way humans log in, nor does it add an extra step.</span>';
218 echo '</td></tr>';
219
220 $cookie_lifetime = array();
221 $cookie_lifetime[] = array('val' => '14', 'label' => '14 days (default)');
222 $cookie_lifetime[] = array('val' => '30', 'label' => '30 days');
223 $cookie_lifetime[] = array('val' => '90', 'label' => '3 months');
224 $cookie_lifetime[] = array('val' => '180', 'label' => '6 months');
225 $cookie_lifetime[] = array('val' => '365', 'label' => '1 year');
226
227 echo '<tr valign="top">
228 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="cookie_lifetime" for="cookie_lifetime">Cookie Lifetime</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="cookie_lifetime" class="open-upsell pro-label">PRO</a></th>
229 <td>';
230 echo '<div class="open-upsell open-upsell-block" data-feature="cookie_lifetime">';
231 echo '<select id="cookie_lifetime">';
232 WPCaptcha_Utility::create_select_options($cookie_lifetime, $options['cookie_lifetime']);
233 echo '</select>';
234 echo '</div>';
235 echo '<span>Cookie lifetime if "Remember Me" option is checked on login form.</span>';
236 echo '</td></tr>';
237
238 echo '<tr><td></td><td>';
239 WPCaptcha_admin::footer_save_button();
240 echo '</td></tr>';
241
242 echo '</tbody></table>';
243 }
244
245 static function tab_tools()
246 {
247 $options = WPCaptcha_Setup::get_options();
248
249 echo '<table class="form-table"><tbody>';
250
251 echo '<tr valign="top">
252 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="test_email" for="password_check">Email Test</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="test_email" class="open-upsell pro-label">PRO</a></th>
253 <td>';
254 echo '<div class="open-upsell open-upsell-block" data-feature="test_email">';
255 echo '<button class="button button-primary button-large" style="margin-bottom:6px;">Send test email</button>';
256 echo '</div>';
257 echo '<span>Send an email to test that you can receive emails from your website.</span>';
258 echo '</td></tr>';
259
260 echo '<tr valign="top">
261 <th scope="row"><label class="open-upsell open-upsell-block" data-feature="honeypot" for="recovery_url">Recovery URL</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="recovery_url" class="open-upsell pro-label">PRO</a></th>
262 <td>';
263 echo '<div class="open-upsell open-upsell-block" data-feature="recovery_url">';
264 echo '<button class="button button-primary button-large" style="margin-bottom:6px;">View Recovery URL</button>';
265 echo '</div>';
266 echo '<span>In case you lock yourself out and need to whitelist your IP address, please save the recovery URL somewhere safe.<br>Do NOT share the recovery URL.</span>';
267 echo '</td></tr>';
268
269 echo '<tr valign="top">
270 <th><label class="open-upsell open-upsell-block" data-feature="import_file">Import Settings</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="import_file" class="open-upsell pro-label">PRO</a></th>
271 <td>';
272 echo '<div class="open-upsell open-upsell-block" data-feature="import_file">';
273 echo '<input accept="txt" type="file" name="wpcaptcha_import_file" value="">
274 <button name="wpcaptcha_import_file" id="submit" class="button button-primary button-large" value="">Upload</button>';
275 echo '</div>';
276 echo '</td>
277 </tr>';
278
279 echo '<tr valign="top">
280 <th><label class="open-upsell open-upsell-block" data-feature="export">Export Settings</label><a title="This feature is available in the PRO version. Click for details." href="#" data-feature="export" class="open-upsell pro-label">PRO</a></th>
281 <td>';
282 echo '<div class="open-upsell open-upsell-block" data-feature="export">';
283 echo '<a class="button button-primary button-large" style="padding-top: 3px;" href="' . esc_url(add_query_arg(array('action' => 'wpcaptcha_export_settings'), admin_url('admin.php'))) . '">Download Export File</a>';
284 echo '</div>';
285 echo '</td>
286 </tr>';
287
288 echo '</tbody></table>';
289 }
290 } // class WPCaptcha_Tab_Login_Form
291