mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 12:23:06 +08:00
Merge branch 'koogua/v1.6.6' into demo
This commit is contained in:
commit
16dafaf21e
@ -1,3 +1,5 @@
|
|||||||
|
### [v1.6.6](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.6)(2023-08-15)
|
||||||
|
|
||||||
### [v1.6.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.5)(2023-07-15)
|
### [v1.6.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.5)(2023-07-15)
|
||||||
|
|
||||||
- 升级layui-v2.8.8
|
- 升级layui-v2.8.8
|
||||||
|
@ -34,15 +34,13 @@ class SessionController extends \Phalcon\Mvc\Controller
|
|||||||
return $this->response->redirect(['for' => 'admin.index']);
|
return $this->response->redirect(['for' => 'admin.index']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sessionService = new SessionService();
|
|
||||||
|
|
||||||
$captcha = $sessionService->getSettings('captcha');
|
|
||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$this->checkHttpReferer();
|
$this->checkHttpReferer();
|
||||||
$this->checkCsrfToken();
|
$this->checkCsrfToken();
|
||||||
|
|
||||||
|
$sessionService = new SessionService();
|
||||||
|
|
||||||
$sessionService->login();
|
$sessionService->login();
|
||||||
|
|
||||||
$location = $this->url->get(['for' => 'admin.index']);
|
$location = $this->url->get(['for' => 'admin.index']);
|
||||||
@ -54,7 +52,6 @@ class SessionController extends \Phalcon\Mvc\Controller
|
|||||||
|
|
||||||
$this->view->pick('public/login');
|
$this->view->pick('public/login');
|
||||||
$this->view->setVar('app_info', $appInfo);
|
$this->view->setVar('app_info', $appInfo);
|
||||||
$this->view->setVar('captcha', $captcha);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +9,6 @@ namespace App\Http\Admin\Services;
|
|||||||
|
|
||||||
use App\Services\Auth\Admin as AdminAuth;
|
use App\Services\Auth\Admin as AdminAuth;
|
||||||
use App\Validators\Account as AccountValidator;
|
use App\Validators\Account as AccountValidator;
|
||||||
use App\Validators\Captcha as CaptchaValidator;
|
|
||||||
|
|
||||||
class Session extends Service
|
class Session extends Service
|
||||||
{
|
{
|
||||||
@ -34,18 +33,6 @@ class Session extends Service
|
|||||||
|
|
||||||
$validator->checkIfAllowLogin($user);
|
$validator->checkIfAllowLogin($user);
|
||||||
|
|
||||||
$captcha = $this->getSettings('captcha');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 验证码是一次性的,放到最后检查,减少第三方调用
|
|
||||||
*/
|
|
||||||
if ($captcha['enabled'] == 1) {
|
|
||||||
|
|
||||||
$validator = new CaptchaValidator();
|
|
||||||
|
|
||||||
$validator->checkCode($post['captcha']['ticket'], $post['captcha']['rand']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->auth->saveAuthInfo($user);
|
$this->auth->saveAuthInfo($user);
|
||||||
|
|
||||||
$this->eventsManager->fire('Account:afterLogin', $this, $user);
|
$this->eventsManager->fire('Account:afterLogin', $this, $user);
|
||||||
|
@ -68,9 +68,9 @@ class Topic extends Service
|
|||||||
$page = $pagerQuery->getPage();
|
$page = $pagerQuery->getPage();
|
||||||
$limit = $pagerQuery->getLimit();
|
$limit = $pagerQuery->getLimit();
|
||||||
|
|
||||||
$pageRepo = new TopicRepo();
|
$topicRepo = new TopicRepo();
|
||||||
|
|
||||||
return $pageRepo->paginate($params, $sort, $page, $limit);
|
return $topicRepo->paginate($params, $sort, $page, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTopic($id)
|
public function getTopic($id)
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% set disabled_submit = captcha.enabled == 1 ? 'disabled="disabled"' : '' %}
|
|
||||||
{% set disabled_class = captcha.enabled == 1 ? 'layui-btn-disabled' : '' %}
|
|
||||||
|
|
||||||
<div class="kg-login-wrap">
|
<div class="kg-login-wrap">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-header">后台登录</div>
|
<div class="layui-card-header">后台登录</div>
|
||||||
@ -12,26 +9,15 @@
|
|||||||
<form class="layui-form kg-login-form" method="POST" action="{{ url({'for':'admin.login'}) }}">
|
<form class="layui-form kg-login-form" method="POST" action="{{ url({'for':'admin.login'}) }}">
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-icon layui-icon-username"></label>
|
<label class="layui-icon layui-icon-username"></label>
|
||||||
<input id="cl-account" class="layui-input" type="text" name="account" autocomplete="off" placeholder="手机 / 邮箱" lay-verify="required">
|
<input class="layui-input" type="text" name="account" autocomplete="off" placeholder="手机 / 邮箱" lay-verify="required">
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-icon layui-icon-password"></label>
|
<label class="layui-icon layui-icon-password"></label>
|
||||||
<input class="layui-input" type="password" name="password" value="123456" autocomplete="off" placeholder="密码" lay-verify="required">
|
<input class="layui-input" type="password" name="password" value="123456" autocomplete="off" placeholder="密码" lay-verify="required">
|
||||||
</div>
|
</div>
|
||||||
{% if captcha.enabled == 1 %}
|
|
||||||
<div id="captcha-block" class="layui-form-item">
|
|
||||||
<div class="layui-input-block">
|
|
||||||
<button id="cl-emit-btn" class="layui-btn layui-btn-fluid" type="button">点击完成验证</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<button id="cl-submit-btn" class="layui-btn layui-btn-fluid {{ disabled_class }}" {{ disabled_submit }} lay-submit="true" lay-filter="go">立即登录</button>
|
<button class="layui-btn layui-btn-fluid" lay-submit="true" lay-filter="go">立即登录</button>
|
||||||
<input id="cl-captcha-enabled" type="hidden" value="{{ captcha.enabled }}">
|
|
||||||
<input id="cl-captcha-appId" type="hidden" value="{{ captcha.app_id }}">
|
|
||||||
<input id="cl-captcha-ticket" type="hidden" name="captcha[ticket]">
|
|
||||||
<input id="cl-captcha-rand" type="hidden" name="captcha[rand]">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -74,7 +60,6 @@
|
|||||||
|
|
||||||
{{ js_include('lib/jquery.min.js') }}
|
{{ js_include('lib/jquery.min.js') }}
|
||||||
{{ js_include('lib/jquery.buoyant.min.js') }}
|
{{ js_include('lib/jquery.buoyant.min.js') }}
|
||||||
{{ js_include('https://ssl.captcha.qq.com/TCaptcha.js', false) }}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
@ -87,7 +72,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$('body').buoyant({
|
jquery('body').buoyant({
|
||||||
elementClass: 'circles',
|
elementClass: 'circles',
|
||||||
numberOfItems: 20,
|
numberOfItems: 20,
|
||||||
minRadius: 5,
|
minRadius: 5,
|
||||||
@ -95,27 +80,4 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
|
||||||
layui.use(['jquery'], function () {
|
|
||||||
|
|
||||||
var $ = layui.jquery;
|
|
||||||
|
|
||||||
if ($('#cl-captcha-enabled').val() === '1') {
|
|
||||||
var captcha = new TencentCaptcha(
|
|
||||||
$('#cl-emit-btn')[0],
|
|
||||||
$('#cl-captcha-appId').val(),
|
|
||||||
function (res) {
|
|
||||||
if (res.ret === 0) {
|
|
||||||
$('#cl-captcha-ticket').val(res.ticket);
|
|
||||||
$('#cl-captcha-rand').val(res.randstr);
|
|
||||||
$('#cl-submit-btn').removeClass('layui-btn-disabled').removeAttr('disabled');
|
|
||||||
$('#captcha-block').hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -16,7 +16,7 @@ class AppInfo
|
|||||||
|
|
||||||
protected $link = 'https://www.koogua.com';
|
protected $link = 'https://www.koogua.com';
|
||||||
|
|
||||||
protected $version = '1.6.5';
|
protected $version = '1.6.6';
|
||||||
|
|
||||||
public function __get($name)
|
public function __get($name)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ trait Auth
|
|||||||
return $this->getGuestUser();
|
return $this->getGuestUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache == false) {
|
if (!$cache) {
|
||||||
$userRepo = new UserRepo();
|
$userRepo = new UserRepo();
|
||||||
$user = $userRepo->findById($authUser['id']);
|
$user = $userRepo->findById($authUser['id']);
|
||||||
} else {
|
} else {
|
||||||
@ -54,7 +54,7 @@ trait Auth
|
|||||||
|
|
||||||
$validator->checkAuthUser($authUser['id']);
|
$validator->checkAuthUser($authUser['id']);
|
||||||
|
|
||||||
if ($cache == false) {
|
if (!$cache) {
|
||||||
$userRepo = new UserRepo();
|
$userRepo = new UserRepo();
|
||||||
$user = $userRepo->findById($authUser['id']);
|
$user = $userRepo->findById($authUser['id']);
|
||||||
} else {
|
} else {
|
||||||
@ -74,6 +74,7 @@ trait Auth
|
|||||||
|
|
||||||
$user->id = 0;
|
$user->id = 0;
|
||||||
$user->name = 'guest';
|
$user->name = 'guest';
|
||||||
|
$user->avatar = kg_cos_user_avatar_url(null);
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user