function instruction_for_mobile_registration($current_user)
{
    if (!get_user_meta($current_user->ID, 'mo2f_mobile_registration_status', true)) {
        download_instruction_for_mobile_app($current_user);
    }
    ?>
<div>
		<h3>Step-2 : Scan QR code</h3><hr>
			
			<form name="f" method="post" action="">
				<input type="hidden" name="option" value="mo_auth_refresh_mobile_qrcode" />
					<?php 
    if (get_user_meta($current_user->ID, 'mo2f_mobile_registration_status', true)) {
        ?>
					<div id="reconfigurePhone">
					<a  data-toggle="collapse" href="#mo2f_show_download_app" aria-expanded="false" >Click here to see Authenticator App download instructions.</a>
					<div id="mo2f_show_download_app" class="collapse">
						<?php 
        download_instruction_for_mobile_app($current_user);
        ?>
					</div>
					<br>
					<h4>Please click on 'Reconfigure your phone' button below to see QR Code.</h4>
					<input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
					<input type="submit" name="submit" class="button button-primary button-large" value="Reconfigure your phone" />	
					</div>
					
					<?php 
    } else {
        ?>
					<div id="configurePhone"><h4>Please click on 'Configure your phone' button below to see QR Code.</h4>
					<input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
					<input type="submit" name="submit" class="button button-primary button-large" value="Configure your phone" />
					</div>
					<?php 
    }
    ?>
			</form>
				
					 <?php 
    if (isset($_SESSION['mo2f_show_qr_code']) && $_SESSION['mo2f_show_qr_code'] == 'MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST['option']) && $_POST['option'] == 'mo_auth_refresh_mobile_qrcode') {
        initialize_mobile_registration();
        if (get_user_meta($current_user->ID, 'mo2f_mobile_registration_status', true)) {
            ?>
									<script>jQuery("#mo2f_app_div").show();</script>
								<?php 
        } else {
            ?>
									<script>jQuery("#mo2f_app_div").hide();</script>
								<?php 
        }
    } else {
        ?>
<br><br>
					<form name="f" method="post" action="" id="mo2f_cancel_form">
					<input type="hidden" name="option" value="mo2f_cancel_configuration" />
					
					</form>
		
					<script>
					jQuery('#back_btn').click(function() {	
						jQuery('#mo2f_cancel_form').submit();
					});
					</script>
					<?php 
    }
    ?>
					
					
	<?php 
}
function prompt_user_for_miniorange_app_setup_frontend($current_user)
{
    $opt = (array) get_option('mo2f_auth_methods_for_users');
    ?>
	<div class="modal" tabindex="-1" role="dialog" id="myModal9">
	 <div class="mo2f-modal-backdrop"></div>
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title">Setup miniOrange Authenticator App</h4>
			</div>
	<div class="modal-body">
	<p><?php 
    echo $_SESSION['mo2f-login-message'];
    ?>
</p>
		
			<?php 
    download_instruction_for_mobile_app($_SESSION['mo2f_current_user']);
    ?>
		<div class="mo_margin_left">
			<h4>Step-2 : Scan QR code</h4><hr class="mo_hr">
			<div id="mo2f_configurePhone"><h4>Please click on 'Configure your phone' button below to see QR Code.</h4>
			<br>
			<?php 
    if (sizeof($opt) > 1) {
        ?>
					<input type="button" name="back" id="mo2f_inline_back_btn" class="miniorange-button" value="Back" />
			<?php 
    }
    ?>
					<input type="button" name="submit" onclick="moconfigureapp();" class="miniorange-button" value="Configure your phone" />
			</div>
			
			<?php 
    if (isset($_SESSION['mo2f_show_qr_code']) && $_SESSION['mo2f_show_qr_code'] == 'MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST['miniorange_inline_show_qrcode_nonce']) && wp_verify_nonce($_POST['miniorange_inline_show_qrcode_nonce'], 'miniorange-2-factor-inline-show-qrcode-nonce')) {
        initialize_inline_mobile_registration_frontend();
        ?>
									<script>jQuery("#mo2f_app_div").hide();</script>
						<?php 
    }
    ?>
			<br>
			
		</div>
	
		<?php 
    if (get_option('mo2f_disable_poweredby') != 1) {
        ?>
				<div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php 
        if (get_option('mo2f_enable_custom_poweredby') == 1) {
            echo site_url() . '/wp-content/uploads/custom.png';
        } else {
            echo plugins_url('/includes/images/miniOrange2.png', __FILE__);
        }
        ?>
');"></div></a></div>
				<?php 
    }
    ?>
		</div>
		 </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<style>
.woocommerce .woocommerce-error {
  display: none !important;
}
</style>
		<script>
			jQuery('.woocommerce-error').hide();
			jQuery('#myModal9').modal('show');
			
			function mologinback(){
				jQuery('#mo2f_2fa_form_close').submit();
			}
			
			function moconfigureapp(){
				jQuery('#mo2f_inline_configureapp_form').submit();
			 }
			 jQuery('#mo2f_inline_back_btn').click(function() {	
					jQuery('#mo2f_goto_two_factor_form').submit();
			});
		</script>
	
	
	<?php 
}
function prompt_user_for_miniorange_app_setup($current_user)
{
    $opt = (array) get_option('mo2f_auth_methods_for_users');
    ?>
		<div class="miniorange_app_setup_page">
		<div class="miniorange-app-setup-container">
		<h2 class="mo_header_background">Setup miniOrange Authenticator App</h2>
		<div class="mo_margin_left">
		<br>
		<p><b><?php 
    echo $_SESSION['mo2f-login-message'];
    ?>
</b></p>
		<br>
		<p class='mo2f_success_container' ><?php 
    echo $_SESSION['mo2f-login-message'];
    ?>
</p>
			<?php 
    download_instruction_for_mobile_app($_SESSION['mo2f_current_user']);
    ?>
			<div class="mo_margin_left">
			<br>
			<h3>Step-2 : Scan QR code</h3><hr class="mo_hr">
			<br>
			<div id="mo2f_configurePhone"><h4>Please click on 'Configure your phone' button below to see QR Code.</h4>
			<br>
			<?php 
    if (sizeof($opt) > 1) {
        ?>
					<input type="button" name="back" id="mo2f_inline_back_btn" class="miniorange-button" value="Back" />
			<?php 
    }
    ?>
					<input type="button" name="submit" onclick="moconfigureapp();" class="miniorange-button" value="Configure your phone" />
			</div>
			
			<?php 
    if (isset($_SESSION['mo2f_show_qr_code']) && $_SESSION['mo2f_show_qr_code'] == 'MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST['miniorange_inline_show_qrcode_nonce']) && wp_verify_nonce($_POST['miniorange_inline_show_qrcode_nonce'], 'miniorange-2-factor-inline-show-qrcode-nonce')) {
        initialize_inline_mobile_registration();
        ?>
									<script>jQuery("#mo2f_app_div").hide();</script>
						<?php 
    }
    ?>
			<br>
			</div>
		<?php 
    if (sizeof($opt) == 1) {
        ?>
		<input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
		<?php 
    }
    ?>
		<br><br>
		</div>
		<div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange"></div></a></div>
			</div>
		</div>
		<script>
			jQuery("div#login").hide();
			jQuery("body.login div#login").before(jQuery('.miniorange_app_setup_page'));
			function mologinback(){
				jQuery('#mo2f_backto_mo_loginform').submit();
			}
			
			function moconfigureapp(){
				jQuery('#mo2f_inline_configureapp_form').submit();
			 }
			 jQuery('#mo2f_inline_back_btn').click(function() {	
					jQuery('#mo2f_goto_two_factor_form').submit();
			});
		</script>
	
	
	<?php 
}