fix #4363 【ユーザー管理】ログインパスワードの複雑度のチェックを行う・行わないでヘルプの表示を変更#4389
Open
kaburk wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
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 ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
よろしくお願いします。