captcha.php
1 year ago
common.php
1 year ago
dashboard.php
1 year ago
disable-access-system-file.php
7 months ago
disable-author-query.php
1 year ago
disable-login.php
1 year ago
disable-restapi.php
1 year ago
disable-xmlrpc.php
1 year ago
login-log-table.php
1 year ago
login-log.php
1 year ago
login-notification.php
1 year ago
rename-login-page.php
1 year ago
restrict-admin-page.php
1 year ago
server-error-notification.php
1 year ago
server-error-table.php
1 year ago
two-factor-authentication-registration.php
5 months ago
two-factor-authentication.php
1 year ago
unify-messages.php
1 year ago
update-notice.php
1 year ago
waf-table.php
1 year ago
waf.php
7 months ago
disable-login.php
153 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | class CloudSecureWP_Admin_Disable_Login extends CloudSecureWP_Admin_Common { |
| 8 | private $disable_login; |
| 9 | private $constant_settings; |
| 10 | |
| 11 | function __construct( array $info, CloudSecureWP_Disable_Login $disable_login ) { |
| 12 | parent::__construct( $info ); |
| 13 | $this->disable_login = $disable_login; |
| 14 | $this->constant_settings = $this->disable_login->get_constant_settings(); |
| 15 | $this->prepare_view_data(); |
| 16 | $this->render(); |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * 画面表示用のデータを準備 |
| 21 | */ |
| 22 | public function prepare_view_data(): void { |
| 23 | $this->datas = $this->disable_login->get_settings(); |
| 24 | |
| 25 | if ( ! empty( $_POST ) && check_admin_referer( $this->disable_login->get_feature_key() . '_csrf' ) ) { |
| 26 | |
| 27 | foreach ( $this->datas as $key => $val ) { |
| 28 | |
| 29 | switch ( $key ) { |
| 30 | case 'disable_login': |
| 31 | $tmp = sanitize_text_field( $_POST[ $key ] ?? '' ); |
| 32 | if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) { |
| 33 | $this->errors[] = '有効・無効の値が不正です'; |
| 34 | } |
| 35 | |
| 36 | if ( ! $this->check_environment() ) { |
| 37 | $tmp = 'f'; |
| 38 | } |
| 39 | |
| 40 | $this->datas[ $key ] = $tmp; |
| 41 | break; |
| 42 | |
| 43 | case 'disable_login_interval': |
| 44 | $tmp = sanitize_text_field( $_POST[ $key ] ?? '' ); |
| 45 | if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_login_interval'] ) ) { |
| 46 | $this->errors[] = '間隔の値が不正です'; |
| 47 | } |
| 48 | $this->datas[ $key ] = $tmp; |
| 49 | break; |
| 50 | |
| 51 | case 'disable_login_limit': |
| 52 | $tmp = sanitize_text_field( $_POST[ $key ] ?? '' ); |
| 53 | if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_login_limit'] ) ) { |
| 54 | $this->errors[] = 'ログイン失敗回数の値が不正です'; |
| 55 | } |
| 56 | $this->datas[ $key ] = $tmp; |
| 57 | break; |
| 58 | |
| 59 | case 'disable_login_duration': |
| 60 | $tmp = sanitize_text_field( $_POST[ $key ] ?? '' ); |
| 61 | if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_login_duration'] ) ) { |
| 62 | $this->errors[] = 'ログイン無効時間の値が不正です'; |
| 63 | } |
| 64 | $this->datas[ $key ] = $tmp; |
| 65 | break; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | if ( empty( $this->errors ) ) { |
| 70 | if ( 't' === $this->datas['disable_login'] ) { |
| 71 | $this->messages[] = 'ログイン無効化機能が有効になりました。'; |
| 72 | } else { |
| 73 | $this->messages[] = 'ログイン無効化機能が無効になりました。'; |
| 74 | } |
| 75 | |
| 76 | $this->disable_login->save_settings( $this->datas ); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | $this->datas = $this->get_checked( $this->datas, array( 'disable_login', 'disable_login_interval', 'disable_login_limit', 'disable_login_duration' ) ); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * デスクリプション |
| 85 | */ |
| 86 | protected function admin_description(): void { |
| 87 | ?> |
| 88 | <nav> |
| 89 | <ul class="breadcrumb"> |
| 90 | <li class="breadcrumb__list"><a href="?page=cloudsecurewp">ダッシュボード</a></li> |
| 91 | <li class="breadcrumb__list">ログイン無効化</li> |
| 92 | </ul> |
| 93 | </nav> |
| 94 | <div class="title-block mb-12"> |
| 95 | <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/disable_login.php">こちら</a></p> |
| 96 | <h1 class="title-block-title">ログイン無効化</h1> |
| 97 | </div> |
| 98 | <div class="title-bottom-text"> |
| 99 | 指定した期間� |
| 100 | にログイン失敗回数が指定した回数に達した場合、指定した時間ログインを無効化(ブロック)します。 |
| 101 | </div> |
| 102 | <?php |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * ページコンテンツ |
| 107 | */ |
| 108 | protected function page(): void { |
| 109 | ?> |
| 110 | <form method="post"> |
| 111 | <div class="enabled-or-disabled"> |
| 112 | <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="disable_login" value="t" <?php echo esc_html( $this->datas['disable_login_t'] ?? '' ); ?> /><label for="enabled">有効</label> |
| 113 | <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="disable_login" value="f" <?php echo esc_html( $this->datas['disable_login_f'] ?? '' ); ?> /><label for="disabled">無効</label> |
| 114 | </div> |
| 115 | <div class="box"> |
| 116 | <div class="box-bottom"> |
| 117 | <div class="box-row flex-start"> |
| 118 | <div class="box-row-title not-label">間隔</div> |
| 119 | <div class="box-row-content radio-btns"> |
| 120 | <input type="radio" class="circle-radio" id="interval-s" name="disable_login_interval" value="<?php echo esc_attr( $this->constant_settings['disable_login_interval'][0] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_interval_' . $this->constant_settings['disable_login_interval'][0] ] ?? '' ); ?> /><label for="interval-s"><?php echo esc_html( $this->constant_settings['disable_login_interval'][0] ); ?> 秒</label><br /> |
| 121 | <input type="radio" class="circle-radio" id="interval-m" name="disable_login_interval" value="<?php echo esc_attr( $this->constant_settings['disable_login_interval'][1] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_interval_' . $this->constant_settings['disable_login_interval'][1] ] ?? '' ); ?> /><label for="interval-m"><?php echo esc_html( $this->constant_settings['disable_login_interval'][1] ); ?> 秒</label><br /> |
| 122 | <input type="radio" class="circle-radio" id="interval-l" name="disable_login_interval" value="<?php echo esc_attr( $this->constant_settings['disable_login_interval'][2] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_interval_' . $this->constant_settings['disable_login_interval'][2] ] ?? '' ); ?> /><label for="interval-l"><?php echo esc_html( $this->constant_settings['disable_login_interval'][2] ); ?> 秒</label> |
| 123 | </div> |
| 124 | </div> |
| 125 | <div class="box-row flex-start"> |
| 126 | <div class="box-row-title not-label">ログイン失敗回数</div> |
| 127 | <div class="box-row-content radio-btns"> |
| 128 | <input type="radio" id="failure-s" class="circle-radio" name="disable_login_limit" value="<?php echo esc_attr( $this->constant_settings['disable_login_limit'][0] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_limit_' . $this->constant_settings['disable_login_limit'][0] ] ?? '' ); ?> /><label for="failure-s"><?php echo esc_html( $this->constant_settings['disable_login_limit'][0] ); ?> 回</label><br /> |
| 129 | <input type="radio" id="failure-m" class="circle-radio" name="disable_login_limit" value="<?php echo esc_attr( $this->constant_settings['disable_login_limit'][1] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_limit_' . $this->constant_settings['disable_login_limit'][1] ] ?? '' ); ?> /><label for="failure-m"><?php echo esc_html( $this->constant_settings['disable_login_limit'][1] ); ?> 回</label><br /> |
| 130 | <input type="radio" id="failure-l" class="circle-radio" name="disable_login_limit" value="<?php echo esc_attr( $this->constant_settings['disable_login_limit'][2] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_limit_' . $this->constant_settings['disable_login_limit'][2] ] ?? '' ); ?> /><label for="failure-l"><?php echo esc_html( $this->constant_settings['disable_login_limit'][2] ); ?> 回</label> |
| 131 | </div> |
| 132 | </div> |
| 133 | <div class="box-row flex-start"> |
| 134 | <div class="box-row-title not-label">ログイン無効時間</div> |
| 135 | <div class="box-row-content radio-btns"> |
| 136 | <input type="radio" id="invalid-ss" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][0] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][0] ] ?? '' ); ?> /><label for="invalid-ss"><?php echo esc_html( $this->constant_settings['disable_login_duration'][0] ); ?> 秒</label><br /> |
| 137 | <input type="radio" id="invalid-s" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][1] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][1] ] ?? '' ); ?> /><label for="invalid-s"><?php echo esc_html( $this->constant_settings['disable_login_duration'][1] ); ?> 秒</label><br /> |
| 138 | <input type="radio" id="invalid-m" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][2] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][2] ] ?? '' ); ?> /><label for="invalid-m"><?php echo esc_html( $this->constant_settings['disable_login_duration'][2] ); ?> 秒</label><br /> |
| 139 | <input type="radio" id="invalid-l" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][3] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][3] ] ?? '' ); ?> /><label for="invalid-l"><?php echo esc_html( $this->constant_settings['disable_login_duration'][3] ); ?> 秒</label><br /> |
| 140 | <input type="radio" id="invalid-ll" class="circle-radio" name="disable_login_duration" value="<?php echo esc_attr( $this->constant_settings['disable_login_duration'][4] ); ?>" <?php echo esc_html( $this->datas[ 'disable_login_duration_' . $this->constant_settings['disable_login_duration'][4] ] ?? '' ); ?> /><label for="invalid-ll"><?php echo esc_html( $this->constant_settings['disable_login_duration'][4] ); ?> 秒</label> |
| 141 | </div> |
| 142 | </div> |
| 143 | </div> |
| 144 | </div> |
| 145 | <div id="submit-btn-area"> |
| 146 | <?php $this->nonce_wp( $this->disable_login->get_feature_key() ); ?> |
| 147 | <?php $this->submit_button_wp(); ?> |
| 148 | </div> |
| 149 | </form> |
| 150 | <?php |
| 151 | } |
| 152 | } |
| 153 |