wp-otp-profile-display.php 2.58 KB
Newer Older
noplanman's avatar
noplanman committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<?php
/**
 * Render the WP-OTP section in the user profile in WP Admin
 *
 * @since 0.1.0
 */
?>

<a name="wp_otp"></a>
<h2>Set up WP-OTP</h2>
<table class="form-table">
	<tr>
		<th>
			<label for="wp_otp_qr_code_img"><?php _e( 'QR Code', 'wp-otp' ); ?></label><br>
			<span class="description">Download any OTP Authenticator app on your smart phone and
					scan this QR Code to setup WP-OTP.</span>
		</th>
		<td width="40%">
			<img src="<?php echo $otp_qr_code_uri; ?>" id="wp_otp_qr_code_img"/><br>
			<?php printf( __( 'OTP Secret: %s', 'wp-otp' ), implode( ' ', str_split( $secret, 4 ) ) ); ?>
		</td>
		<td>
			<?php foreach ( $otp_apps as $otp_app ): ?>
				<?php $app_name = esc_attr( $otp_app['name'] ); ?>
				<a href="<?php echo $otp_app['uri']; ?>"><strong><?php echo $otp_app['name']; ?></strong><br>
					<img src="<?php echo $otp_app['uri_logo']; ?>"
					     alt="<?php echo $app_name; ?>"
					     title="<?php echo $app_name; ?>"
					/></a>&nbsp;
				<?php foreach ( $app_providers as $app_provider_key => $app_provider ): ?>
					<?php
					$get_it_on_text = sprintf(
						esc_attr__( 'Get it on %s', 'wp-otp' ),
						$app_provider['name']
					);
					?>
					<a href="<?php echo $otp_app[ 'uri_' . $app_provider_key ]; ?>" target="_blank">
						<img src="<?php echo $app_provider['uri_logo']; ?>"
						     alt="<?php echo $get_it_on_text; ?>"
						     title="<?php echo $get_it_on_text; ?>"
						/></a>&nbsp;
				<?php endforeach; ?>
				<br><br>
			<?php endforeach; ?>
			<?php _e( 'Blackberry users can search and install any OTP app on their phone.', 'wp-otp' ); ?>
		</td>
	</tr>
	<tr>
		<?php if ( $otp_enabled ): ?>
			<th>
				<?php _e( 'WP-OTP Configured', 'wp-otp' ); ?>
			</th>
			<td colspan="2">
				<?php
				printf(
					'%1$s <a href="%2$s" onclick = "return confirm(\'%3$s\')">%4$s</a>',
					__( 'WP-OTP is already configured.', 'wp-otp' ),
58
					add_query_arg( 'wp-otp-delete', 'yes' ),
noplanman's avatar
noplanman committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
					'Are you sure you want to reconfigure WP-OTP?',
					__( 'Reconfigure?', 'wp-otp' )
				);
				?>
			</td>
		<?php else: ?>
			<th>
				<label for="wp_otp_code"><?php _e( 'One Time Password', 'wp-otp' ); ?></label>
			</th>
			<td colspan="2">
				<input type="text" size="25"
				       value="<?php echo isset( $_POST['wp_otp_code'] ) ? $_POST['wp_otp_code'] : ''; ?>"
				       name="wp_otp_code" id="wp_otp_code"/><br/>

				<?php _e( 'Enter the One Time Password from Google Authenticator app on your smartphone <br>
						WP-OTP will not work unless you Enter the OTP here and click on <b>Update Profile</b> button below.',
					'wp-otp' ); ?>
			</td>
		<?php endif; ?>
	</tr>
</table>