/** * 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; }
/** * Create Rublon page in the menu */ function rublon2factor_add_menu_entries() { $main_title = __('Rublon', 'rublon'); $settings_page = add_utility_page($main_title, $main_title, 'read', 'rublon', 'rublon2factor_render_settings_page', 'div'); $general_title = __('Settings', 'rublon'); add_submenu_page('rublon', 'Rublon: ' . $general_title, $general_title, 'read', 'rublon', 'rublon2factor_render_settings_page'); if (RublonHelper::isSiteRegistered()) { if (RublonFeature::checkFeature(RublonAPIGetAvailableFeatures::FEATURE_OPERATION_CONFIRMATION)) { $confirmationTitle = __('Confirmations', 'rublon'); add_submenu_page('rublon', 'Rublon: ' . $confirmationTitle, $confirmationTitle, 'manage_options', 'rublon_confirmations', 'rublon2factor_render_confirmations_page'); } if (RublonHelper::canShowTDMWidget()) { $trusted_title = __('Trusted Devices', 'rublon'); add_submenu_page('rublon', 'Rublon: ' . $trusted_title, $trusted_title, 'read', 'rublon_tdm', 'rublon2factor_render_tdm_page'); $current_user = wp_get_current_user(); if (RublonHelper::canShowACM() && RublonHelper::isUserAuthenticated($current_user)) { $acm_title = __('Account Sharing', 'rublon'); add_submenu_page('rublon', 'Rublon: ' . $acm_title, $acm_title, 'read', 'rublon_acm', 'rublon2factor_render_acm_page'); } } } }