From 83db8e36161aafba1dd9105c50351d5ad8e7f6ed Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Sun, 31 Mar 2024 13:54:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=94=A8=E6=88=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=8A=9F=E8=83=BD=E7=9A=84=E5=90=AF=E7=94=A8/?= =?UTF-8?q?=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/UserController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/UserController.php b/controllers/UserController.php index 60bfd7b..9d0fbbe 100644 --- a/controllers/UserController.php +++ b/controllers/UserController.php @@ -410,6 +410,11 @@ class UserController extends Controller return $this->goHome(); } + if ($_ENV['REGISTRATION_ENABLED'] === 'false') { + Yii::$app->session->setFlash('error', '站点已关闭注册'); + return $this->goHome(); + } + $model = new User(['scenario' => 'register']); if ($model->load(Yii::$app->request->post()) && $model->validate()) { // 根据 verifyProvider 的值选择使用哪种验证码服务 @@ -518,7 +523,7 @@ class UserController extends Controller Yii::$app->session->setFlash('error', 'Failed to change password.'); } } - }else{ + } else { Yii::$app->session->setFlash('error', 'Failed to validate password.'); } if (Yii::$app->user->can('admin')) {