From 72deb17daaa1b44a77dbe09e2091ebcdaed169a3 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Mon, 24 Mar 2025 23:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E6=B3=A8=E5=86=8C=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Admin/Views/setting/live.volt | 4 ++-- app/Services/Logic/Account/Register.php | 2 ++ app/Validators/Account.php | 23 +++++++++++++++++++++++ config/errors.php | 3 +++ public/static/admin/css/common.css | 19 ------------------- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/app/Http/Admin/Views/setting/live.volt b/app/Http/Admin/Views/setting/live.volt index 73149767..3698c563 100644 --- a/app/Http/Admin/Views/setting/live.volt +++ b/app/Http/Admin/Views/setting/live.volt @@ -65,7 +65,7 @@ layer.open({ type: 2, title: '推流测试', - area: ['720px', '500px'], + area: ['720px', '540px'], content: [url, 'no'] }); }); @@ -85,4 +85,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/app/Services/Logic/Account/Register.php b/app/Services/Logic/Account/Register.php index 449e7030..d1678de6 100644 --- a/app/Services/Logic/Account/Register.php +++ b/app/Services/Logic/Account/Register.php @@ -36,6 +36,8 @@ class Register extends LogicService $accountValidator = new AccountValidator(); + $accountValidator->checkRegisterStatus($post['account']); + $accountValidator->checkLoginName($post['account']); $data = []; diff --git a/app/Validators/Account.php b/app/Validators/Account.php index f3ff1f61..74aad9ec 100644 --- a/app/Validators/Account.php +++ b/app/Validators/Account.php @@ -129,6 +129,29 @@ class Account extends Validator } } + public function checkRegisterStatus($account) + { + $local = $this->getSettings('oauth.local'); + + $allowPhone = $local['register_with_phone'] ?? false; + $allowEmail = $local['register_with_email'] ?? false; + + $isEmail = CommonValidator::email($account); + $isPhone = CommonValidator::Phone($account); + + if (!$allowPhone && !$allowEmail) { + throw new BadRequestException('account.register_disabled'); + } + + if ($isPhone && !$allowPhone) { + throw new BadRequestException('account.register_with_phone_disabled'); + } + + if ($isEmail && !$allowEmail) { + throw new BadRequestException('account.register_with_email_disabled'); + } + } + public function checkVerifyLogin($name, $code) { $this->checkLoginName($name); diff --git a/config/errors.php b/config/errors.php index c5fff84c..74a3e970 100644 --- a/config/errors.php +++ b/config/errors.php @@ -57,6 +57,9 @@ $error['account.phone_taken'] = '手机号被占用'; $error['account.pwd_not_match'] = '密码不匹配'; $error['account.origin_pwd_incorrect'] = '原有密码不正确'; $error['account.login_pwd_incorrect'] = '登录密码不正确'; +$error['account.register_disabled'] = '注册已关闭'; +$error['account.register_with_phone_disabled'] = '手机注册已关闭'; +$error['account.register_with_email_disabled'] = '邮箱注册已关闭'; /** * 用户相关 diff --git a/public/static/admin/css/common.css b/public/static/admin/css/common.css index c773f2a1..5c16e8dd 100644 --- a/public/static/admin/css/common.css +++ b/public/static/admin/css/common.css @@ -14,21 +14,6 @@ padding-bottom: 0; } -.layui-copyright { - position: fixed; - z-index: 999; - left: 0; - bottom: 0; - width: 180px; - padding: 10px; - font-size: 12px; - color: rgba(255, 255, 255, .7); -} - -.layui-copyright a { - color: rgba(255, 255, 255, .7); -} - .red { color: red; } @@ -300,10 +285,6 @@ img.kg-qrcode { border: 3px solid #999; } -.kg-order-date { - margin-left: 30px; -} - .kg-order-item { margin-top: 10px; padding-top: 10px;