| 1 |
<?php |
| 2 |
// Do not allow the file to be called directly. |
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
?> |
| 7 |
<h2><?php esc_attr_e( 'Two Factor Authentication Configuration', 'patchstack' ); ?></h2> |
| 8 |
<table class="form-table"> |
| 9 |
<tbody> |
| 10 |
<tr> |
| 11 |
<th scope="row"><?php esc_attr_e( 'Enable 2FA', 'patchstack' ); ?></th> |
| 12 |
<td> |
| 13 |
<fieldset> |
| 14 |
<legend class="screen-reader-text"><span><?php esc_attr_e( 'Enable 2FA', 'patchstack' ); ?></span></legend> |
| 15 |
<label for="patchstack_2fa_enabled"><input name="patchstack_2fa_enabled" type="checkbox" id="patchstack_2fa_enabled" value="1" <?php echo checked( 1, get_user_option( 'webarx_2fa_enabled', $user->ID ), false ); ?>> <?php esc_attr_e( 'Enable 2FA on your account.', 'patchstack' ); ?></label><br /> |
| 16 |
</fieldset> |
| 17 |
</td> |
| 18 |
</tr> |
| 19 |
<tr> |
| 20 |
<th scope="row"><?php esc_attr_e( 'Secret Key', 'patchstack' ); ?></th> |
| 21 |
<td> |
| 22 |
<fieldset> |
| 23 |
<legend class="screen-reader-text"><span><?php esc_attr_e( 'Secret Key', 'patchstack' ); ?></span></legend> |
| 24 |
<label for="patchstack_2fa_secretkey"><input name="patchstack_2fa_secretkey" type="text" id="patchstack_2fa_secretkey" value="<?php echo esc_attr( $secret ); ?>"></label><br /> |
| 25 |
</fieldset> |
| 26 |
</td> |
| 27 |
</tr> |
| 28 |
<tr> |
| 29 |
<th scope="row"><?php esc_attr_e( 'QR Code Image', 'patchstack' ); ?></th> |
| 30 |
<td> |
| 31 |
<fieldset> |
| 32 |
<legend class="screen-reader-text"><span><?php esc_attr_e( 'QR Code Image', 'patchstack' ); ?></span></legend> |
| 33 |
<div id="qrcode"></div><br /> |
| 34 |
<?php esc_attr_e( 'Scan this image with your 2FA app.', 'patchstack' ); ?> |
| 35 |
<script type="text/javascript"> |
| 36 |
jQuery(function(){ |
| 37 |
new QRCode(document.getElementById("qrcode"), { |
| 38 |
text: "<?php echo 'otpauth://totp/WordPress:' . rawurlencode( get_bloginfo( 'name' ) ) . '?secret=' . rawurlencode( $secret ) . '&issuer=WordPress'; ?>", |
| 39 |
width: 128, |
| 40 |
height: 128, |
| 41 |
}); |
| 42 |
}) |
| 43 |
</script> |
| 44 |
</fieldset> |
| 45 |
</td> |
| 46 |
</tr> |
| 47 |
</tbody> |
| 48 |
</table> |
| 49 |
|