Skip to content

Commit 6971ae4

Browse files
committed
Gracefully handle invalid or unset denylist
1 parent 839f986 commit 6971ae4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/controllers/User/Register.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,13 @@ protected function tryRegister(Router &$router, UserRegisterModel &$model) {
127127
}
128128
$denylist = Common::$config->bnetdocs->user_password_denylist_map;
129129
$denylist = json_decode(file_get_contents('./' . $denylist));
130-
foreach ($denylist as $denylist_pw) {
131-
if (strtolower($denylist_pw->password) == strtolower($pw1)) {
132-
$model->error = 'PASSWORD_BLACKLIST';
133-
$model->error_extra = $denylist_pw->reason;
134-
return;
130+
if ($denylist) {
131+
foreach ($denylist as $denylist_pw) {
132+
if (strtolower($denylist_pw->password) == strtolower($pw1)) {
133+
$model->error = 'PASSWORD_BLACKLIST';
134+
$model->error_extra = $denylist_pw->reason;
135+
return;
136+
}
135137
}
136138
}
137139
if (function_exists('geoip_country_code_by_name')) {

0 commit comments

Comments
 (0)