PluginProbe
DoLogin Security / trunk
DoLogin Security vtrunk
5.0.10 4.8.3 trunk 1.0 1.1 1.1.1 1.2 1.2.1 1.2.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 1.6 All 64 releases
dologin / tpl / setting.tpl.php

setting.tpl.php in DoLogin Security trunk, at tpl/setting.tpl.php

440 lines 17.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settings tab template.
4 *
5 * @package dologin
6 */
7
8 namespace dologin;
9
10 defined( 'WPINC' ) || exit;
11
12 $dologin_gui = $this->cls( 'GUI' );
13
14 $dologin_current_user_2fa = $this->cls( 'TwoFA' )->current_status();
15 $dologin_kl_requirements = KLSso::requirements();
16 $dologin_kl_fingerprint = KLSso::site_key_fingerprint();
17 $dologin_kl_public_key = KLSso::site_encryption_public_key();
18
19 ?>
20 <form method="post" action="<?php echo esc_url( menu_page_url( 'dologin', false ) ); ?>" class="dologin-relative">
21 <?php wp_nonce_field( 'dologin' ); ?>
22
23 <h3 class="dologin-title-short"><?php esc_html_e( 'Limit Login Attempt Settings', 'dologin' ); ?></h3>
24
25 <table class="wp-list-table striped dologin-table">
26 <tbody>
27 <tr>
28 <th><?php esc_html_e( 'Lockout', 'dologin' ); ?></th>
29 <td>
30 <p><?php $dologin_gui->build_input( 'max_retries', 'dologin-input-short2' ); ?> <?php esc_html_e( 'Allowed retries', 'dologin' ); ?></p>
31 <p><?php $dologin_gui->build_input( 'duration', 'dologin-input-short2' ); ?> <?php esc_html_e( 'minutes lockout', 'dologin' ); ?></p>
32 <div class="dologin-desc">
33 <?php
34 echo wp_kses_post(
35 sprintf(
36 /* translators: 1: max retries count, 2: lockout duration in minutes. */
37 __( 'If hit %1$s maximum retries in %2$s minutes, the login attempt from that IP will be temporarily disabled.', 'dologin' ),
38 '<code>' . esc_html( Conf::val( 'max_retries' ) ) . '</code>',
39 '<code>' . esc_html( Conf::val( 'duration' ) ) . '</code>'
40 )
41 );
42 ?>
43 </div>
44 </td>
45 </tr>
46 </tbody>
47 </table>
48
49 <h3 class="dologin-title-short"><?php esc_html_e( '2FA Settings', 'dologin' ); ?></h3>
50
51 <table class="wp-list-table striped dologin-table">
52 <tbody>
53 <tr>
54 <th><?php esc_html_e( 'Two-factor Authentication', 'dologin' ); ?></th>
55 <td>
56 <?php $dologin_gui->build_switch( '2fa' ); ?>
57 <div class="dologin-desc">
58 <?php esc_html_e( 'Verify 2FA code for each login attempt.', 'dologin' ); ?>
59 <?php esc_html_e( 'Users need to finish 2FA validation in their profile.', 'dologin' ); ?>
60 <br />
61 <?php
62 echo wp_kses_post(
63 sprintf(
64 /* translators: %s: example 2FA app name. */
65 __( 'Can use any 2FA app, e.g. %s', 'dologin' ),
66 '<code>Google Authenticator</code>'
67 )
68 );
69 ?>
70 </div>
71 </td>
72 </tr>
73
74 <tr>
75 <th><?php esc_html_e( 'Force 2FA Auth Validation', 'dologin' ); ?></th>
76 <td>
77 <?php $dologin_gui->build_switch( '2fa_force' ); ?>
78 <div class="dologin-desc">
79 <?php esc_html_e( 'If enabled this, any user without 2FA setup in profile will not be able to login.', 'dologin' ); ?>
80 <a href="profile.php"><?php esc_html_e( 'Click here to manage your 2FA secret', 'dologin' ); ?></a>
81 <?php if ( ! $dologin_current_user_2fa && Conf::val( '2fa' ) && Conf::val( '2fa_force' ) ) : ?>
82 <div class="dologin-warning-h3">
83 <?php esc_html_e( 'You need to setup your 2FA before enabling this setting to avoid yourself being blocked from next time login.', 'dologin' ); ?>
84 </div>
85 <?php endif; ?>
86 </div>
87 </td>
88 </tr>
89 </tbody>
90 </table>
91
92 <h3 class="dologin-title-short"><?php esc_html_e( 'KeyLockr SSO Settings', 'dologin' ); ?></h3>
93
94 <table class="wp-list-table striped dologin-table">
95 <tbody>
96 <tr>
97 <th><?php esc_html_e( 'App Tag', 'dologin' ); ?></th>
98 <td>
99 <?php $dologin_gui->build_input( 'kl_sso_svc_id' ); ?>
100 <div class="dologin-desc">
101 <?php echo wp_kses_post( __( 'Copy the effective <code>App Tag</code> from KeyLockr. If no custom <code>App Tag</code> is set, use the decimal <code>Service ID</code>.', 'dologin' ) ); ?>
102 </div>
103 <div class="dologin-desc dologin-kl-setup">
104 <p class="dologin-kl-mydev-intro">
105 <?php
106 echo wp_kses_post(
107 sprintf(
108 /* translators: 1: opening link tag, 2: closing link tag. */
109 __( '%1$sCreate a KeyLockr SSO service in MyDeveloper%2$s, or open an existing service, then use these settings.', 'dologin' ),
110 '<a href="' . esc_url( KLSso::DEVELOPER_ADD_URL ) . '" target="_blank" rel="noopener noreferrer">',
111 '</a>'
112 )
113 );
114 ?>
115 </p>
116
117 <div class="dologin-kl-key-panel">
118 <div class="dologin-kl-key-row">
119 <strong class="dologin-kl-key-label"><?php esc_html_e( 'Service Encryption Public Key (X25519, Base64)', 'dologin' ); ?></strong>
120 <div class="dologin-kl-key-value">
121 <?php if ( is_wp_error( $dologin_kl_public_key ) ) : ?>
122 <code id="dologin-kl-encryption-public-key" class="dologin-kl-encryption-public-key"><?php esc_html_e( 'Unavailable', 'dologin' ); ?></code>
123 <?php else : ?>
124 <code id="dologin-kl-encryption-public-key" class="dologin-kl-encryption-public-key"><?php echo esc_html( $dologin_kl_public_key ); ?></code>
125 <button type="button" class="button dologin-kl-copy-public-key"><?php esc_html_e( 'Copy Public Key', 'dologin' ); ?></button>
126 <?php endif; ?>
127 <span class="dologin-kl-copy-status" aria-live="polite"></span>
128 </div>
129 <p>
130 <?php
131 echo wp_kses_post(
132 sprintf(
133 /* translators: 1: opening code tag, 2: closing code tag. */
134 __( 'Paste this exact value into %1$sService key%2$s in the %1$sSSO Keys%2$s block in %1$sMyDeveloper%2$s. The matching private key remains protected on this WordPress site.', 'dologin' ),
135 '<code>',
136 '</code>'
137 )
138 );
139 ?>
140 </p>
141 </div>
142 <div class="dologin-kl-key-row">
143 <strong class="dologin-kl-key-label"><?php esc_html_e( 'Site Key Fingerprint', 'dologin' ); ?></strong>
144 <div class="dologin-kl-key-value">
145 <?php if ( is_wp_error( $dologin_kl_fingerprint ) ) : ?>
146 <code id="dologin-kl-site-key-fingerprint"><?php esc_html_e( 'Unavailable', 'dologin' ); ?></code>
147 <span class="dologin-kl-site-key-status dologin-danger"><?php echo esc_html( $dologin_kl_fingerprint->get_error_message() ); ?></span>
148 <?php else : ?>
149 <code id="dologin-kl-site-key-fingerprint"><?php echo esc_html( $dologin_kl_fingerprint ); ?></code>
150 <span class="dologin-kl-site-key-status" aria-live="polite"></span>
151 <?php endif; ?>
152 <button type="button" class="button dologin-kl-reset-keys" <?php disabled( KLSso::force_enabled() ); ?>><?php esc_html_e( 'Reset Site Keys', 'dologin' ); ?></button>
153 </div>
154 <p>
155 <?php
156 echo wp_kses_post(
157 sprintf(
158 /* translators: 1: opening code tag, 2: closing code tag. */
159 __( 'The fixed signing and encryption keys keep this WordPress backend on one KeyLockr connection identity. Use %1$sReset Site Keys%2$s only to create a new identity, then update %1$sService key%2$s in the %1$sSSO Keys%2$s block in %1$sMyDeveloper%2$s before scanning again.', 'dologin' ),
160 '<code>',
161 '</code>'
162 )
163 );
164 ?>
165 </p>
166 <?php if ( KLSso::force_enabled() ) : ?>
167 <p class="dologin-warn"><?php echo wp_kses_post( __( 'Disable <code>Force KeyLockr SSO</code> before resetting the site keys.', 'dologin' ) ); ?></p>
168 <?php endif; ?>
169 </div>
170 </div>
171
172 <div class="dologin-kl-mydev-settings" role="group" aria-label="<?php esc_attr_e( 'Required MyDeveloper settings', 'dologin' ); ?>">
173 <strong><?php echo wp_kses_post( __( 'Configure only these <code>MyDeveloper</code> blocks. Turn every other option off.', 'dologin' ) ); ?></strong>
174 <dl>
175 <div class="dologin-kl-mydev-row">
176 <dt><?php esc_html_e( 'Service basics', 'dologin' ); ?></dt>
177 <dd>
178 <?php
179 echo wp_kses_post(
180 sprintf(
181 /* translators: 1: opening code tag, 2: closing code tag. */
182 __( 'Use any recognizable %1$sService Title%2$s. Leave %1$sServer IPs%2$s empty. Keep %1$sApp Data Storage%2$s on. Copy the effective %1$sApp Tag%2$s into the %1$sDoLogin App Tag%2$s field above.', 'dologin' ),
183 '<code>',
184 '</code>'
185 )
186 );
187 ?>
188 </dd>
189 </div>
190 <div class="dologin-kl-mydev-row">
191 <dt><?php esc_html_e( 'SSO Keys', 'dologin' ); ?></dt>
192 <dd>
193 <?php
194 echo wp_kses_post(
195 sprintf(
196 /* translators: 1: opening code tag, 2: closing code tag. */
197 __( 'Paste the public key shown above into %1$sService key%2$s, select %1$sbackend%2$s under %1$sKey owner%2$s, and click %1$sUpdate%2$s.', 'dologin' ),
198 '<code>',
199 '</code>'
200 )
201 );
202 ?>
203 </dd>
204 </div>
205 </dl>
206 </div>
207 <p class="dologin-kl-mydev-finish"><?php esc_html_e( 'Save DoLogin settings, link this WordPress account, and test SSO before forcing QR-only login.', 'dologin' ); ?></p>
208 <?php if ( $dologin_kl_requirements ) : ?>
209 <div class="dologin-warning-h3">
210 <?php echo esc_html( implode( ' ', $dologin_kl_requirements ) ); ?>
211 </div>
212 <?php endif; ?>
213 </div>
214 </td>
215 </tr>
216
217 <tr>
218 <th><?php esc_html_e( 'KeyLockr SSO Login', 'dologin' ); ?></th>
219 <td>
220 <?php $dologin_gui->build_switch( 'kl_sso' ); ?>
221 <div class="dologin-desc">
222 <?php esc_html_e( 'Show KeyLockr QR login. The WordPress backend directly verifies and decrypts the signed KeyLockr completion, then verifies the encrypted app data hash.', 'dologin' ); ?>
223 <div class="dologin-kl-link">
224 <strong><?php esc_html_e( 'Link Current Account', 'dologin' ); ?></strong>
225 <?php $this->cls( 'KLSso' )->bind_form(); ?>
226 <?php if ( empty( KLSso::current_user_status()['bound'] ) ) : ?>
227 <p><?php esc_html_e( 'Scan with KeyLockr on your phone. The account is linked only after the authorization result directly supplies its app data filekey and the app data is written and read back successfully.', 'dologin' ); ?></p>
228 <?php endif; ?>
229 </div>
230 </div>
231 </td>
232 </tr>
233
234 <tr>
235 <th><?php esc_html_e( 'Force KeyLockr SSO', 'dologin' ); ?></th>
236 <td>
237 <?php $dologin_gui->build_switch( 'kl_sso_force' ); ?>
238 <div class="dologin-desc">
239 <?php echo wp_kses_post( __( 'Hide the password form and allow only KeyLockr QR login. DoLogin enables this only after the current administrator has a verified binding for the saved <code>App Tag</code> and site keys. Once enabled, failures never restore other login methods; rename the plugin folder through FTP or the hosting file manager if external recovery is required.', 'dologin' ) ); ?>
240 </div>
241 </td>
242 </tr>
243 </tbody>
244 </table>
245
246 <h3 class="dologin-title-short"><?php esc_html_e( 'Cloudflare Turnstile Settings', 'dologin' ); ?></h3>
247
248 <table class="wp-list-table striped dologin-table">
249 <tbody>
250 <tr>
251 <th><?php esc_html_e( 'Cloudflare Turnstile', 'dologin' ); ?></th>
252 <td>
253 <?php $dologin_gui->build_switch( 'cf' ); ?>
254 <div class="dologin-desc">
255 <?php
256 printf(
257 /* translators: %s: page name where Cloudflare Turnstile is shown. */
258 esc_html__( 'This will enable Cloudflare Turnstile on %s page.', 'dologin' ),
259 esc_html__( 'Login', 'dologin' )
260 );
261 ?>
262 </div>
263 </td>
264 </tr>
265
266 <tr>
267 <th><?php esc_html_e( 'Cloudflare Turnstile on Register Page', 'dologin' ); ?></th>
268 <td>
269 <?php $dologin_gui->build_switch( 'recapt_register' ); ?>
270 <div class="dologin-desc">
271 <?php
272 printf(
273 /* translators: %s: page name where Cloudflare Turnstile is shown. */
274 esc_html__( 'This will enable Cloudflare Turnstile on %s page.', 'dologin' ),
275 esc_html__( 'Register', 'dologin' )
276 );
277 ?>
278 </div>
279 </td>
280 </tr>
281
282 <!-- https://core.trac.wordpress.org/ticket/49521 -->
283 <tr>
284 <th><?php esc_html_e( 'Cloudflare Turnstile on Lost Password Page', 'dologin' ); ?></th>
285 <td>
286 <?php $dologin_gui->build_switch( 'recapt_forget' ); ?>
287 <div class="dologin-desc">
288 <?php
289 printf(
290 /* translators: %s: page name where Cloudflare Turnstile is shown. */
291 esc_html__( 'This will enable Cloudflare Turnstile on %s page.', 'dologin' ),
292 esc_html__( 'Lost Password', 'dologin' )
293 );
294 ?>
295 </div>
296 </td>
297 </tr>
298
299 <tr>
300 <th><?php esc_html_e( 'Cloudflare Turnstile Keys', 'dologin' ); ?></th>
301 <td>
302 <div class="dologin-row-flex">
303 <div style="margin-right: 50px;">
304 <p><label>
305 <span class="dologin_text_label_prefix"><?php esc_html_e( 'Site Key', 'dologin' ); ?>:</span>
306 <?php $dologin_gui->build_input( 'cf_pub_key', '' ); ?>
307 </label></p>
308 <p><label>
309 <span class="dologin_text_label_prefix"><?php esc_html_e( 'Secret Key', 'dologin' ); ?>:</span>
310 <?php $dologin_gui->build_input( 'cf_priv_key', '' ); ?>
311 </label></p>
312 </div>
313 <div>
314 <?php
315 if ( Conf::val( 'cf' ) || ( Conf::val( 'cf_pub_key' ) && Conf::val( 'cf_priv_key' ) ) ) {
316 $this->cls( 'Captcha' )->show();
317 }
318 ?>
319 </div>
320 </div>
321
322 <div class="dologin-desc">
323 <?php
324 echo wp_kses_post(
325 sprintf(
326 /* translators: 1: opening link tag, 2: closing link tag. */
327 __( 'Generate keys from %1$sCloudflare Turnstile%2$s.', 'dologin' ),
328 // phpcs:ignore PluginCheck.CodeAnalysis.Offloading.OffloadedContent -- Link to the Cloudflare dashboard where the user obtains their Turnstile keys.
329 '<a href="https://dash.cloudflare.com/?to=/:account/turnstile" target="_blank" rel="noopener noreferrer">',
330 '</a>'
331 )
332 );
333 ?>
334 <?php esc_html_e( 'Cloudflare Turnstile is better than Google reCAPTCHA.', 'dologin' ); ?>
335 </div>
336 </td>
337 </tr>
338 </tbody>
339 </table>
340
341 <h3 class="dologin-title-short"><?php esc_html_e( 'General Settings', 'dologin' ); ?></h3>
342
343 <table class="wp-list-table striped dologin-table">
344 <tbody>
345 <tr>
346 <th><?php esc_html_e( 'Whitelist', 'dologin' ); ?></th>
347 <td>
348 <div class="field-col">
349 <?php $dologin_gui->build_textarea( 'whitelist' ); ?>
350 </div>
351 <div class="field-col field-col-desc">
352 <div class="dologin-desc">
353 <?php esc_html_e( 'Format', 'dologin' ); ?>: <code>prefix1:value1, prefix2:value2</code>.
354 <?php esc_html_e( 'Both prefix and value are case insensitive.', 'dologin' ); ?>
355 <?php esc_html_e( 'Spaces around comma/colon are allowed.', 'dologin' ); ?>
356 <?php esc_html_e( 'One rule set per line.', 'dologin' ); ?>
357 </div>
358 <div class="dologin-desc">
359 <?php esc_html_e( 'Prefix list', 'dologin' ); ?>: <code>ip</code>, <code><?php echo wp_kses_post( implode( '</code>, <code>', array_map( 'esc_html', IP::$PREFIX_SET ) ) ); ?></code>.
360 </div>
361 <div class="dologin-desc"><?php esc_html_e( 'IP prefix with colon is optional. IP value support wildcard (*).', 'dologin' ); ?></div>
362 <div class="dologin-desc">
363 <?php
364 echo wp_kses_post(
365 sprintf(
366 /* translators: %s: the # comment character. */
367 __( 'Use %s to append comments in the end of each line.', 'dologin' ),
368 '<code>#</code>'
369 )
370 );
371 ?>
372 <?php
373 echo wp_kses_post(
374 sprintf(
375 /* translators: %s: the !: exclusion operator. */
376 __( 'Use %s to exclude one value.', 'dologin' ),
377 '<code>!:</code>'
378 )
379 );
380 ?>
381 </div>
382 <div class="dologin-desc dologin-row-flex">
383 <div style="margin-right: 10px;">
384 <button type="button" class="button button-primary" id="dologin_get_ip" title="<?php echo esc_attr( sprintf( /* translators: %s: the doapi.us domain. */ __( 'This will send a request to %s to get your public Geolocation info.', 'dologin' ), 'https://doapi.us' ) ); ?>"><?php esc_html_e( 'Check My Geolocation Data', 'dologin' ); ?></button>
385 </div>
386 <code id="dologin_mygeolocation" aria-live="polite">-</code>
387 </div>
388 </div>
389 </td>
390 </tr>
391
392 <tr>
393 <th><?php esc_html_e( 'Blacklist', 'dologin' ); ?></th>
394 <td>
395 <div class="field-col">
396 <?php $dologin_gui->build_textarea( 'blacklist' ); ?>
397 </div>
398 <div class="field-col field-col-desc">
399 <div class="dologin-desc">
400 <?php
401 echo wp_kses_post(
402 sprintf(
403 /* translators: %s: the Whitelist section name. */
404 __( 'Same format as %s', 'dologin' ),
405 '<strong>' . esc_html__( 'Whitelist', 'dologin' ) . '</strong>'
406 )
407 );
408 ?>
409 </div>
410 <div class="dologin-desc"><?php esc_html_e( 'Example', 'dologin' ); ?> 1) <code>ip:1.2.3.*</code></div>
411 <div class="dologin-desc"><?php esc_html_e( 'Example', 'dologin' ); ?> 2) <code>42.20.*.*, continent_code: NA</code> (<?php esc_html_e( 'Dropped optional prefix', 'dologin' ); ?> <code>ip:</code>)</div>
412 <div class="dologin-desc"><?php esc_html_e( 'Example', 'dologin' ); ?> 3) <code>continent: North America, country_code: US, subdivision_code: NY</code></div>
413 <div class="dologin-desc"><?php esc_html_e( 'Example', 'dologin' ); ?> 4) <code>subdivision_code: NY, postal: 10001</code></div>
414 <div class="dologin-desc"><?php esc_html_e( 'Example', 'dologin' ); ?> 5) <code>ip: 1.2.3.* # This is my IP</code></div>
415 <div class="dologin-desc"><?php esc_html_e( 'Example', 'dologin' ); ?> 6) <code>country_code: US, ip!: 1.2.3.4</code> (<?php esc_html_e( 'Match all visitors from US except the IP 1.2.3.4', 'dologin' ); ?> )</div>
416 </div>
417 </td>
418 </tr>
419
420 <tr>
421 <th><?php esc_html_e( 'GDPR Compliance', 'dologin' ); ?></th>
422 <td>
423 <?php $dologin_gui->build_switch( 'gdpr' ); ?>
424 <div class="dologin-desc">
425 <?php esc_html_e( 'With this feature turned on, all logged IPs get obfuscated (md5-hashed).', 'dologin' ); ?>
426 </div>
427 </td>
428 </tr>
429
430
431 </tbody>
432 </table>
433
434 <div class='dologin-top20'></div>
435
436 <?php submit_button( __( 'Save Changes', 'dologin' ), 'primary', 'dologin-submit' ); ?>
437 <?php submit_button( __( 'Save Changes', 'dologin' ), 'primary dologin-float-submit', 'dologin-float-submit' ); ?>
438
439 </form>
440