From a5c2181f6d57513bbcf822852433c388fe316b0b Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 21 Apr 2022 15:51:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Login.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index a4f5b4a74..83a1bf7eb 100644 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -43,25 +43,24 @@ class Login extends Controller if (AdminService::instance()->isLogin()) { $this->redirect(sysuri('admin/index/index')); } else { - // 登录验证码 - $this->captchaType = 'LoginCaptcha'; - $this->captchaToken = CodeExtend::uniqidDate(18); // 当前运行模式 $system = SystemService::instance(); $this->developMode = $system->checkRunMode(); // 后台背景处理 $images = str2arr(sysconf('login_image') ?: '', '|') ?: [ - $system->uri('/static/theme/img/login/bg1.jpg'), - $system->uri('/static/theme/img/login/bg2.jpg'), + $system->uri('/static/theme/img/login/bg1.jpg'), $system->uri('/static/theme/img/login/bg2.jpg'), ]; $this->loginStyle = sprintf('style="background-image:url(%s)" data-bg-transition="%s"', $images[0], join(',', $images)); - // 更新后台域名 - $host = "{$this->request->scheme()}://{$this->request->host()}"; - if ($host !== sysconf('base.site_host')) sysconf('base.site_host', $host); - // 标记验证令牌 + // 登录验证令牌 + $this->captchaType = 'LoginCaptcha'; + $this->captchaToken = CodeExtend::uniqidDate(18); if (!$this->app->session->get('LoginInputSessionError')) { $this->app->session->set($this->captchaType, $this->captchaToken); } + // 更新后台域名 + if ($this->request->domain(true) !== sysconf('base.site_host')) { + sysconf('base.site_host', $this->request->domain(true)); + } // 加载登录模板 $this->title = '系统登录'; $this->fetch();