PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.1.1
CloudSecure WP Security v1.1.1
1.4.10 1.4.9 trunk 0.9.0 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.22 1.3.23 1.3.24 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8
cloudsecure-wp-security / modules / admin / two-factor-authentication.php
cloudsecure-wp-security / modules / admin Last commit date
captcha.php 2 years ago common.php 2 years ago dashboard.php 2 years ago disable-author-query.php 2 years ago disable-login.php 2 years ago disable-restapi.php 2 years ago disable-xmlrpc.php 2 years ago login-log-table.php 2 years ago login-log.php 2 years ago login-notification.php 2 years ago rename-login-page.php 2 years ago restrict-admin-page.php 2 years ago server-error-notification.php 2 years ago server-error-table.php 2 years ago two-factor-authentication-registration.php 2 years ago two-factor-authentication.php 2 years ago unify-messages.php 2 years ago update-notice.php 2 years ago
two-factor-authentication.php
115 lines
1 <?php
2
3 class CloudSecureWP_Admin_Two_Factor_Authentication extends CloudSecureWP_Admin_Common {
4 private $two_factor_authentication;
5
6 function __construct( array $info, CloudSecureWP_Two_Factor_Authentication $two_factor_authentication ) {
7 parent::__construct( $info );
8 $this->two_factor_authentication = $two_factor_authentication;
9 $this->prepare_view_data();
10 $this->render();
11 }
12
13 /**
14 * 画面表示用のデータを準備
15 */
16 public function prepare_view_data(): void {
17 $this->datas = $this->two_factor_authentication->get_settings();
18
19 if ( ! empty( $_POST ) && check_admin_referer( $this->two_factor_authentication->get_feature_key() . '_csrf' ) ) {
20
21 foreach ( $this->datas as $key => $val ) {
22
23 if ( 'two_factor_authentication' === $key ) {
24 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
25 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
26 $this->errors[] = '有効・無効の値が不正です';
27 }
28
29 if ( ! $this->check_environment() ) {
30 $tmp = 'f';
31 }
32
33 $this->datas[ $key ] = $tmp;
34 }
35 }
36
37 if ( empty( $this->errors ) ) {
38
39 $roles = array_map( 'sanitize_text_field', $_POST['roles'] ?? array() );
40 update_option( 'cloudsecurewp_two_factor_authentication_roles', $roles );
41
42 if ( 't' === $this->datas['two_factor_authentication'] ) {
43 $this->messages[] = '2段階認証機能が有効になりました。';
44 } else {
45 $this->messages[] = '2段階認証機能が無効になりました。';
46 }
47
48 $this->two_factor_authentication->save_settings( $this->datas );
49
50 }
51 }
52
53 $this->datas = $this->get_checked( $this->datas, array( 'two_factor_authentication' ) );
54 }
55
56 /**
57 * ディスクリプション
58 */
59 protected function admin_description(): void {
60 ?>
61 <div class="title-block mb-12">
62 <h1 class="title-block-title">2段階認証</h1>
63 <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank"
64 href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/two_factor_authentication.php">こちら</a>
65 </p>
66 </div>
67 <div class="title-bottom-text">
68 ユーザー名とパスワードの�
69 �力に加え、別のコードで追加認証を行います。<br />
70 <b>※利用するには、<a class="title-block-link" href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">Google Authenticator</a>  アプリケーションでデバイスを登録する�
71 要があります。</b>
72 </div>
73 <?php
74 }
75
76 /**
77 * ページコンテンツ
78 */
79 protected function page(): void {
80 $all_roles = array_keys( wp_roles()->roles );
81 $roles = get_option( 'cloudsecurewp_two_factor_authentication_roles', $all_roles );
82 ?>
83 <form method="post">
84 <div class="enabled-or-disabled">
85 <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="two_factor_authentication"
86 value="t" <?php echo esc_html( $this->datas['two_factor_authentication_t'] ?? '' ); ?> /><label for="enabled">有効</label>
87 <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="two_factor_authentication"
88 value="f" <?php echo esc_html( $this->datas['two_factor_authentication_f'] ?? '' ); ?> /><label for="disabled">無効</label>
89 </div>
90 <div class="box">
91 <div class="box-bottom">
92 <div class="box-row flex-start">
93 <div class="box-row-title not-label">2段階認証が有効な権限グループ</div>
94 <div class="box-row-content">
95 <?php foreach ( $all_roles as $key => $role ) : ?>
96 <input type="checkbox" class="checkbox" id="<?php echo esc_attr( $role ); ?>" name="roles[]"
97 value="<?php echo esc_attr( $role ); ?>"<?php checked( in_array( $role, $roles ) ); ?> />
98 <label for="<?php echo esc_attr( $role ); ?>"><?php echo esc_html_x( ucfirst( $role ), 'User role' ); ?></label>
99 <?php if ( $key !== array_key_last( $all_roles ) ) : ?>
100 <br/>
101 <?php endif; ?>
102 <?php endforeach; ?>
103 </div>
104 </div>
105 </div>
106 </div>
107 <div id="submit-btn-area">
108 <?php $this->nonce_wp( $this->two_factor_authentication->get_feature_key() ); ?>
109 <?php $this->submit_button_wp(); ?>
110 </div>
111 </form>
112 <?php
113 }
114 }
115