Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d99e168583 | ||
|
|
d6bb1456fa | ||
|
|
91eac36371 | ||
|
|
1e4486989a |
@@ -14,7 +14,7 @@ use think\Response;
|
||||
class Login extends AdminController
|
||||
{
|
||||
|
||||
protected bool $ignoreAuth = true;
|
||||
protected bool $ignoreLogin = true;
|
||||
|
||||
public function initialize(): void
|
||||
{
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user