Skip to content

fix #4363 【ユーザー管理】ログインパスワードの複雑度のチェックを行う・行わないでヘルプの表示を変更#4389

Open
kaburk wants to merge 1 commit into
baserproject:5.2.xfrom
kaburk:5.2.x-#4363
Open

fix #4363 【ユーザー管理】ログインパスワードの複雑度のチェックを行う・行わないでヘルプの表示を変更#4389
kaburk wants to merge 1 commit into
baserproject:5.2.xfrom
kaburk:5.2.x-#4363

Conversation

@kaburk
Copy link
Copy Markdown
Collaborator

@kaburk kaburk commented May 22, 2026

よろしくお願いします。

スクリーンショット 2026-05-22 18 21 21 スクリーンショット 2026-05-22 18 24 45

Copilot AI review requested due to automatic review settings May 22, 2026 10:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

ユーザー管理画面で、サイト設定「簡易なログインパスワード(複雑度チェックを行わない)」の有効/無効に応じて、パスワード入力欄のヘルプ表示(最小文字数・必要文字種)を出し分ける対応です。パスワードルールは Configure(BcApp.passwordRule) を参照し、管理画面側のヘルプが実際のルールに追随することを狙っています。

Changes:

  • パスワード編集画面/ユーザー追加編集フォームで、最小文字数表示を「簡易パスワード」設定に応じて変更
  • 「簡易パスワード」無効時のみ、必要な文字種(数字/大文字/小文字/記号)をヘルプに表示
  • 追加した文言の翻訳(en.po / pot)を更新

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
plugins/bc-admin-third/templates/Admin/Users/edit_password.php パスワード編集画面のヘルプに、設定に応じた最小文字数・必要文字種の表示を追加
plugins/bc-admin-third/templates/Admin/element/Users/form.php ユーザー追加/編集フォームのパスワードヘルプに同様の表示ロジックを追加
plugins/baser-core/resources/locales/en/baser_core.po 新規追加したヘルプ文言の英訳を追加
plugins/baser-core/resources/locales/baser_core.pot 新規追加したヘルプ文言を翻訳テンプレートに追加
Comments suppressed due to low confidence (2)

plugins/bc-admin-third/templates/Admin/Users/edit_password.php:75

  • このヘルプ表示ロジック(minLength / requiredCharacterTypes の組み立て)が templates/Admin/element/Users/form.php と重複しています。将来パスワードルールが変わった際に表示差分や修正漏れが起きやすいので、共通の要素テンプレート(例: Users/password_help など)に切り出して両方から呼び出す形にすると保守しやすいです。
            <?php if (!BcSiteConfig::get('allow_simple_password')): ?>
              <?php
              $requiredCharacterTypeNames = [
                'numeric'   => __d('baser_core', '数字'),
                'uppercase' => __d('baser_core', '大文字英字'),
                'lowercase' => __d('baser_core', '小文字英字'),
                'symbol'    => __d('baser_core', '記号'),
              ];
              $requiredTypes = Configure::read('BcApp.passwordRule.requiredCharacterTypes') ?: [];
              $requiredNames = array_values(array_intersect_key($requiredCharacterTypeNames, array_flip($requiredTypes)));
              ?>
              <?php if ($requiredNames): ?>
                <li><?php echo __d('baser_core', '{0}を含む必要があります。', implode('・', $requiredNames)) ?></li>

plugins/bc-admin-third/templates/Admin/element/Users/form.php:169

  • このヘルプ表示ロジック(minLength / requiredCharacterTypes の組み立て)が templates/Admin/Users/edit_password.php と重複しています。将来パスワードルールが変わった際に表示差分や修正漏れが起きやすいので、共通の要素テンプレート(例: Users/password_help など)に切り出して両方から呼び出す形にすると保守しやすいです。
            <?php if (!BcSiteConfig::get('allow_simple_password')): ?>
              <?php
              $requiredCharacterTypeNames = [
                'numeric'   => __d('baser_core', '数字'),
                'uppercase' => __d('baser_core', '大文字英字'),
                'lowercase' => __d('baser_core', '小文字英字'),
                'symbol'    => __d('baser_core', '記号'),
              ];
              $requiredTypes = Configure::read('BcApp.passwordRule.requiredCharacterTypes') ?: [];
              $requiredNames = array_values(array_intersect_key($requiredCharacterTypeNames, array_flip($requiredTypes)));
              ?>
              <?php if ($requiredNames): ?>
                <li><?php echo __d('baser_core', '{0}を含む必要があります。', implode('・', $requiredNames)) ?></li>
              <?php endif ?>

Comment on lines +57 to +61
<?php if (BcSiteConfig::get('allow_simple_password')): ?>
<?php echo __d('baser_core', '{0}文字以上で入力してください。', 6) ?>
<?php else: ?>
<?php echo __d('baser_core', '{0}文字以上で入力してください。', Configure::read('BcApp.passwordRule.minLength') ?: 12) ?>
<?php endif ?>
Comment on lines +150 to +154
<?php if (BcSiteConfig::get('allow_simple_password')): ?>
<?php echo __d('baser_core', '{0}文字以上で入力してください。', 6) ?>
<?php else: ?>
<?php echo __d('baser_core', '{0}文字以上で入力してください。', Configure::read('BcApp.passwordRule.minLength') ?: 12) ?>
<?php endif ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants