diff --git a/plugins/Common.php b/plugins/Common.php index 23869fb..63c303b 100644 --- a/plugins/Common.php +++ b/plugins/Common.php @@ -657,10 +657,10 @@ Class Common { $allowed = true; $authDirs = self::getPwdAuthDirsFromSession(); if (!empty($authConfig['default']) && empty($authConfig['allow'][$dir]) && !in_array('default', $authDirs)) { - //所有目录都需要授权 + //所有目录都需要授权,且没有单独配置此目录需要密码 $allowed = false; - }else if (empty($authConfig['default']) && !empty($authConfig['allow'][$dir]) && !in_array($dir, $authDirs)) { - //只有部分目录需要授权 + }else if (!empty($authConfig['allow'][$dir]) && !in_array($dir, $authDirs)) { + //当前目录需要授权 $allowed = false; } diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index ad4a87d..d102378 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -207,7 +207,13 @@ eof; //判断是否需要加密访问的目录 $lockIcon = ''; - if (!empty($authConfig['enable']) && $authConfig['enable'] !== 'false' && !empty($authConfig['allow'][$dir['directory']])) { + if (!empty($authConfig['enable']) && $authConfig['enable'] !== 'false' + && ( + ( empty($authConfig['default']) && !empty($authConfig['allow'][$dir['directory']]) ) + || + !empty($authConfig['default']) //如果所有目录都需要密码 + ) + ) { $lockIcon = <<加密目录 eof;