/**
  * Create Trusted Devices Widget container for WP Dashboard 
  * 
  * @return string
  */
 public function getTDMWidget()
 {
     $result = '';
     if (RublonHelper::isSiteRegistered()) {
         if (RublonHelper::canShowTDMWidget()) {
             $current_user = wp_get_current_user();
             $protection_type = RublonHelper::YES;
             RublonHelper::isUserProtected($current_user, $protection_type);
             switch ($protection_type) {
                 case RublonHelper::PROTECTION_TYPE_MOBILE:
                     $result .= '<p>' . sprintf(__('Your account is protected by <a href="%s" target="_blank">Rublon</a>.', 'rublon'), RublonHelper::rubloncomUrl()) . '</p>';
                     break;
                 case RublonHelper::PROTECTION_TYPE_EMAIL:
                     $result .= '<p>' . sprintf(__('Your account is protected by <a href="%s" target="_blank">Rublon</a>.', 'rublon'), RublonHelper::rubloncomUrl()) . ' ' . sprintf(__('Get the <a href="%s/get" target="_blank">Rublon mobile app</a> for more security.', 'rublon'), RublonHelper::rubloncomUrl()) . '</p>';
                     break;
                 case RublonHelper::PROTECTION_TYPE_NONE:
                     $lang = RublonHelper::getBlogLanguage();
                     $result .= '<p>' . sprintf('<span style="color: red; font-weight: bold;">' . __('Warning!', 'rublon') . '</span>' . ' ' . __('Your account is not protected. Go to <a href="%s">your profile page</a> to enable account protection.', 'rublon'), admin_url(RublonHelper::WP_PROFILE_PAGE . RublonHelper::WP_PROFILE_EMAIL2FA_SECTION)) . '</p>';
                     break;
             }
             $result .= $this->getDeviceWidget();
         } else {
             $result = '<p>' . __('Your account isn\'t protected by Rublon and thus vulnerable to password theft and brute force attacks. Please contact your administrator. ') . '</p>';
         }
     }
     return $result;
 }
示例#2
0
function rublon2factor_render_confirmations_page()
{
    ?>
<div class="wrap">
	<div id="rublon2factor_page">
		<h2 class="rublon-header">
			<?php 
    _e('Rublon', 'rublon');
    ?>
		</h2>

			<?php 
    // necessary, otherwise "updated" messages won't be visible
    settings_errors();
    // Header text
    echo '<p>' . __('Rublon instantly protects all accounts with effortless, email-based two-factor authentication.', 'rublon') . ' ' . __('Get the optional mobile app for more security!', 'rublon') . ' ' . sprintf(__('Learn more at <a href="%s" target="_blank">wordpress.rublon.com</a>.', 'rublon'), RublonHelper::wordpressRublonComURL()) . '</p>';
    // Consumer script
    $current_user = wp_get_current_user();
    if (RublonHelper::isSiteRegistered()) {
        // No protection warning
        if (!RublonHelper::isUserProtected($current_user) && is_user_member_of_blog()) {
            printf('<span style="color: red; font-weight: bold;">' . __('Warning!', 'rublon') . '</span>' . ' ' . __('Your account is not protected. Go to <a href="%s">your profile page</a> to enable account protection.', 'rublon'), admin_url(RublonHelper::WP_PROFILE_PAGE . RublonHelper::WP_PROFILE_EMAIL2FA_SECTION));
        }
        // Rublon settings
        if (current_user_can('manage_options')) {
            // START_BLOCK: Is user authorized to manage plugins?
            ?>

				<form method="post" action="options.php"
			id="rublon-plugin-confirmations-settings">
					<?php 
            settings_fields('rublon2factor_confirmations_settings_group');
            do_settings_sections('rublon_confirmations');
            submit_button();
            echo '<script>//<![CDATA[
						document.addEventListener(\'DOMContentLoaded\', function() {
 							if (RublonWP) {
								RublonWP.setUpFormSubmitListener("rublon-plugin-confirmations-settings", "rublon-confirmation-form");
 							}
 							if (RublonSDK) {
 								RublonSDK.initConfirmationForms();
 							}
						}, false);
					//]]></script>';
            ?>
				</form>
			<?php 
        }
        // END_BLOCK: Is user authorized to manage plugins?
    }
    ?>
	</div>
</div>
<?php 
}