4 Commits
dev ... v8.1.3

Author SHA1 Message Date
wolfcode
d99e168583 Update Install.php 2025-01-15 09:54:11 +08:00
wolfcode
d6bb1456fa build(dependencies): update composer dependencies and adjust view rendering
- Update topthink/think-view dependency to version ^2.0
- Modify view rendering in Install controller to use empty template path
2025-01-15 09:45:07 +08:00
wolfcode
91eac36371 refactor(view): remove redundant template path generation
- Remove unnecessary code that generates a template path based on the request pathinfo
- Simplify the render function by removing the conditional block that sets the template path
2025-01-15 09:28:15 +08:00
wolfcode
1e4486989a refactor(admin): improve login check middleware
- Rename $ignoreAuth to $ignoreLogin for better clarity
- Update comments for better code readability
- Modify Login controller to use $ignoreLogin instead of $ignoreAuth
2025-01-14 10:09:58 +08:00
5 changed files with 9 additions and 10 deletions

View File

@@ -14,7 +14,7 @@ use think\Response;
class Login extends AdminController
{
protected bool $ignoreAuth = true;
protected bool $ignoreLogin = true;
public function initialize(): void
{

View File

@@ -25,9 +25,10 @@ class CheckLogin
$controllerClass = 'app\\admin\\controller\\' . $controller;
$classObj = new ReflectionClass($controllerClass);
$properties = $classObj->getDefaultProperties();
$ignoreAuth = $properties['ignoreAuth'] ?? false;
$adminUserInfo = session('admin');
if (!$ignoreAuth) {
// 整个控制器是否忽略登录
$ignoreLogin = $properties['ignoreLogin'] ?? false;
$adminUserInfo = session('admin');
if (!$ignoreLogin) {
$noNeedCheck = $properties['noNeedCheck'] ?? [];
if (in_array($action, $noNeedCheck)) {
return $next($request);
@@ -37,7 +38,8 @@ class CheckLogin
foreach ($attributes as $attribute) {
$annotation = $attribute->newInstance();
$_ignore = (array)$annotation->ignore;
if (in_array('LOGIN', (array)$_ignore)) return $next($request);
// 控制器中的某个方法忽略登录
if (in_array('LOGIN', $_ignore)) return $next($request);
}
if (empty($adminUserInfo)) {
return redirect(__url('login/index'));

View File

@@ -133,9 +133,6 @@ class AdminController extends BaseController
{
if ($layout) View::instance()->engine()->layout('/layout/default');
View::assign($vars);
if (empty($template)) {
$template = strtolower(str_replace('.', '/', $this->request->pathinfo()));
}
return View::fetch($template);
}

View File

@@ -41,7 +41,7 @@ class Install extends BaseController
];
$currentHost = '://';
$result = compact('errorInfo', 'currentHost', 'isInstall', 'envInfo');
return view('index/install/index', $result);
return view('index@install/index', $result);
}
if ($errorInfo) $this->error($errorInfo);
$charset = 'utf8mb4';

View File

@@ -24,7 +24,7 @@
"topthink/framework": "^8.0",
"topthink/think-orm": "^3.0",
"topthink/think-multi-app": "^1.1.0",
"topthink/think-view": "2.0.0",
"topthink/think-view": "^2.0",
"topthink/think-captcha": "^3.0",
"topthink/think-filesystem": "^2.0",
"aliyuncs/oss-sdk-php": "^2.6",