diff --git a/CHANGELOG.md b/CHANGELOG.md index d58c45c8..da9c4738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ -### [v1.6.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.3)(2023-06-15) +### [v1.6.5](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.5)(2023-07-15) + +- 升级layui-v2.8.8 +- 使用本地图像验证码 +- 清理无用的计划任务 + +### [v1.6.4](https://gitee.com/koogua/course-tencent-cloud/releases/v1.6.4)(2023-06-15) - 增加推荐课程等Widget - 更新Composer包 diff --git a/README.md b/README.md index cfc4cf02..07882628 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Tips: 请用手机注册一个新账号,用户中心 -> 关注订阅,扫码 ### 项目组件 - 后台框架:[phalcon 3.4.5](https://phalcon.io) -- 前端框架:[layui 2.8.2](https://layui.com) +- 前端框架:[layui 2.8.8](https://layui.com) - 全文检索:[xunsearch 1.4.9](http://www.xunsearch.com) - 即时通讯:[workerman 3.5.22](https://workerman.net) - 基础依赖:[php7.3](https://php.net), [mysql5.7](https://mysql.com), [redis5.0](https://redis.io) diff --git a/app/Http/Admin/Controllers/SettingController.php b/app/Http/Admin/Controllers/SettingController.php index 03489cc3..b0d9e840 100644 --- a/app/Http/Admin/Controllers/SettingController.php +++ b/app/Http/Admin/Controllers/SettingController.php @@ -223,36 +223,6 @@ class SettingController extends Controller } } - /** - * @Route("/captcha", name="admin.setting.captcha") - */ - public function captchaAction() - { - $section = 'captcha'; - - $settingService = new SettingService(); - - if ($this->request->isPost()) { - - $data = $this->request->getPost(); - - $settingService->updateSettings($section, $data); - - $content = [ - 'location' => $this->request->getHTTPReferer(), - 'msg' => '更新配置成功', - ]; - - return $this->jsonSuccess($content); - - } else { - - $captcha = $settingService->getSettings($section); - - $this->view->setVar('captcha', $captcha); - } - } - /** * @Route("/point", name="admin.setting.point") */ diff --git a/app/Http/Admin/Services/AuthNode.php b/app/Http/Admin/Services/AuthNode.php index 6df40868..35c59e85 100644 --- a/app/Http/Admin/Services/AuthNode.php +++ b/app/Http/Admin/Services/AuthNode.php @@ -1200,12 +1200,6 @@ class AuthNode extends Service 'type' => 'menu', 'route' => 'admin.setting.sms', ], - [ - 'id' => '5-2-3', - 'title' => '验证码设置', - 'type' => 'menu', - 'route' => 'admin.setting.captcha', - ], [ 'id' => '5-2-4', 'title' => '存储设置', diff --git a/app/Http/Admin/Views/setting/captcha.volt b/app/Http/Admin/Views/setting/captcha.volt deleted file mode 100644 index 1b05a222..00000000 --- a/app/Http/Admin/Views/setting/captcha.volt +++ /dev/null @@ -1,124 +0,0 @@ -{% extends 'templates/main.volt' %} - -{% block content %} - - {% set captcha_display = captcha.enabled == 1 ? 'display:block' : 'display:none' %} - -
-
- 验证码配置 -
-
- -
- - -
-
-
-
- -
- -
-
-
- -
- -
-
-
-
- -
- - -
-
-
- -
-
- 验证码测试 -
-
- -
- - -
-
-
- -
- - - - -
-
-
- -{% endblock %} - -{% block inline_js %} - - - - - -{% endblock %} \ No newline at end of file diff --git a/app/Http/Admin/Views/setting/dingtalk_robot.volt b/app/Http/Admin/Views/setting/dingtalk_robot.volt index cdc91e9a..e624dd70 100644 --- a/app/Http/Admin/Views/setting/dingtalk_robot.volt +++ b/app/Http/Admin/Views/setting/dingtalk_robot.volt @@ -16,7 +16,7 @@
- +
diff --git a/app/Http/Api/Controllers/VerifyController.php b/app/Http/Api/Controllers/VerifyController.php index 3f0c8b8c..533ad1bd 100644 --- a/app/Http/Api/Controllers/VerifyController.php +++ b/app/Http/Api/Controllers/VerifyController.php @@ -7,9 +7,10 @@ namespace App\Http\Api\Controllers; -use App\Services\Logic\Verify\MailCode as MailCodeService; -use App\Services\Logic\Verify\SmsCode as SmsCodeService; -use App\Services\Logic\Verify\Ticket as TicketService; +use App\Services\Logic\Verify\Captcha as VerifyCaptchaService; +use App\Services\Logic\Verify\Code as VerifyCodeService; +use App\Services\Logic\Verify\MailCode as VerifyMailCodeService; +use App\Services\Logic\Verify\SmsCode as VerifySmsCodeService; /** * @RoutePrefix("/api/verify") @@ -18,15 +19,27 @@ class VerifyController extends Controller { /** - * @Post("/ticket", name="api.verify.ticket") + * @Get("/captcha", name="api.verify.captcha") */ - public function ticketAction() + public function captchaAction() { - $service = new TicketService(); + $service = new VerifyCaptchaService(); - $ticket = $service->handle(); + $captcha = $service->handle(); - return $this->jsonSuccess(['ticket' => $ticket]); + return $this->jsonSuccess(['captcha' => $captcha]); + } + + /** + * @Post("/code", name="api.verify.code") + */ + public function codeAction() + { + $service = new VerifyCodeService(); + + $service->handle(); + + return $this->jsonSuccess(); } /** @@ -34,7 +47,7 @@ class VerifyController extends Controller */ public function smsCodeAction() { - $service = new SmsCodeService(); + $service = new VerifySmsCodeService(); $service->handle(); @@ -46,7 +59,7 @@ class VerifyController extends Controller */ public function mailCodeAction() { - $service = new MailCodeService(); + $service = new VerifyMailCodeService(); $service->handle(); diff --git a/app/Http/Home/Controllers/AccountController.php b/app/Http/Home/Controllers/AccountController.php index 819e6520..093fbea1 100644 --- a/app/Http/Home/Controllers/AccountController.php +++ b/app/Http/Home/Controllers/AccountController.php @@ -15,6 +15,9 @@ use App\Services\Logic\Account\PasswordReset as PasswordResetService; use App\Services\Logic\Account\PasswordUpdate as PasswordUpdateService; use App\Services\Logic\Account\PhoneUpdate as PhoneUpdateService; +/** + * @RoutePrefix("/account") + */ class AccountController extends Controller { @@ -40,15 +43,10 @@ class AccountController extends Controller $oauthProvider = $service->handle(); - $service = new AccountService(); - - $captcha = $service->getSettings('captcha'); - $this->seo->prependTitle('用户注册'); $this->view->setVar('return_url', $returnUrl); $this->view->setVar('local_oauth', $oauthProvider['local']); - $this->view->setVar('captcha', $captcha); } /** @@ -67,10 +65,6 @@ class AccountController extends Controller return $this->response->redirect('/'); } - $service = new AccountService(); - - $captcha = $service->getSettings('captcha'); - $service = new OAuthProviderService(); $oauthProvider = $service->handle(); @@ -81,7 +75,6 @@ class AccountController extends Controller $this->view->setVar('oauth_provider', $oauthProvider); $this->view->setVar('return_url', $returnUrl); - $this->view->setVar('captcha', $captcha); } /** @@ -112,13 +105,7 @@ class AccountController extends Controller return $this->response->redirect(['for' => 'home.index']); } - $service = new AccountService(); - - $captcha = $service->getSettings('captcha'); - $this->seo->prependTitle('重置密码'); - - $this->view->setVar('captcha', $captcha); } /** diff --git a/app/Http/Home/Controllers/VerifyController.php b/app/Http/Home/Controllers/VerifyController.php index f494fed8..9a6c1f37 100644 --- a/app/Http/Home/Controllers/VerifyController.php +++ b/app/Http/Home/Controllers/VerifyController.php @@ -7,40 +7,22 @@ namespace App\Http\Home\Controllers; -use App\Services\Logic\Verify\MailCode as MailCodeService; -use App\Services\Logic\Verify\SmsCode as SmsCodeService; use App\Traits\Response as ResponseTrait; /** * @RoutePrefix("/verify") */ -class VerifyController extends \Phalcon\Mvc\Controller +class VerifyController extends Controller { use ResponseTrait; /** - * @Post("/sms/code", name="home.verify.sms_code") + * @Get("/captcha", name="home.verify.captcha") */ - public function smsCodeAction() + public function captchaAction() { - $service = new SmsCodeService(); - - $service->handle(); - - return $this->jsonSuccess(); - } - - /** - * @Post("/mail/code", name="home.verify.mail_code") - */ - public function mailCodeAction() - { - $service = new MailCodeService(); - - $service->handle(); - - return $this->jsonSuccess(); + $this->view->pick('verify/captcha'); } } diff --git a/app/Http/Home/Services/Account.php b/app/Http/Home/Services/Account.php index 02e771db..50bbe9dd 100644 --- a/app/Http/Home/Services/Account.php +++ b/app/Http/Home/Services/Account.php @@ -62,18 +62,6 @@ class Account extends Service $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->eventsManager->fire('Account:afterLogin', $this, $user); diff --git a/app/Http/Home/Views/account/forget.volt b/app/Http/Home/Views/account/forget.volt index 78c3b2eb..8ee30fee 100644 --- a/app/Http/Home/Views/account/forget.volt +++ b/app/Http/Home/Views/account/forget.volt @@ -35,7 +35,6 @@ {% block include_js %} - {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} {{ js_include('home/js/captcha.verify.phone.js') }} {{ js_include('home/js/captcha.verify.email.js') }} diff --git a/app/Http/Home/Views/account/forget_by_email.volt b/app/Http/Home/Views/account/forget_by_email.volt index c203d6bd..58e7427f 100644 --- a/app/Http/Home/Views/account/forget_by_email.volt +++ b/app/Http/Home/Views/account/forget_by_email.volt @@ -5,7 +5,7 @@
- +
@@ -19,8 +19,6 @@
- -
diff --git a/app/Http/Home/Views/account/forget_by_phone.volt b/app/Http/Home/Views/account/forget_by_phone.volt index f70b6c69..da10f212 100644 --- a/app/Http/Home/Views/account/forget_by_phone.volt +++ b/app/Http/Home/Views/account/forget_by_phone.volt @@ -5,7 +5,7 @@
- +
@@ -19,8 +19,6 @@
- -
diff --git a/app/Http/Home/Views/account/login.volt b/app/Http/Home/Views/account/login.volt index 5bbcc1f1..cb277348 100644 --- a/app/Http/Home/Views/account/login.volt +++ b/app/Http/Home/Views/account/login.volt @@ -44,8 +44,6 @@ {% block include_js %} - {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} - {{ js_include('home/js/captcha.login.js') }} {{ js_include('home/js/captcha.verify.js') }} {% endblock %} diff --git a/app/Http/Home/Views/account/login_by_password.volt b/app/Http/Home/Views/account/login_by_password.volt index 000303e3..6fdc7231 100644 --- a/app/Http/Home/Views/account/login_by_password.volt +++ b/app/Http/Home/Views/account/login_by_password.volt @@ -1,6 +1,3 @@ -{% set disabled_submit = captcha.enabled == 1 ? 'disabled="disabled"' : '' %} -{% set disabled_class = captcha.enabled == 1 ? 'layui-btn-disabled' : '' %} - \ No newline at end of file diff --git a/app/Http/Home/Views/account/login_by_verify.volt b/app/Http/Home/Views/account/login_by_verify.volt index fe00dcb3..feb750ad 100644 --- a/app/Http/Home/Views/account/login_by_verify.volt +++ b/app/Http/Home/Views/account/login_by_verify.volt @@ -15,11 +15,9 @@
- - - +
\ No newline at end of file diff --git a/app/Http/Home/Views/account/register.volt b/app/Http/Home/Views/account/register.volt index 390ab9b4..c2bf9264 100644 --- a/app/Http/Home/Views/account/register.volt +++ b/app/Http/Home/Views/account/register.volt @@ -39,7 +39,6 @@ {% block include_js %} - {{ js_include('https://ssl.captcha.qq.com/TCaptcha.js',false) }} {{ js_include('home/js/account.register.js') }} {{ js_include('home/js/captcha.verify.phone.js') }} {{ js_include('home/js/captcha.verify.email.js') }} diff --git a/app/Http/Home/Views/account/register_by_email.volt b/app/Http/Home/Views/account/register_by_email.volt index b1cf9832..f6c486d9 100644 --- a/app/Http/Home/Views/account/register_by_email.volt +++ b/app/Http/Home/Views/account/register_by_email.volt @@ -2,11 +2,11 @@