From 91c388b99161dba364d4bfb7f3d72fb733305a72 Mon Sep 17 00:00:00 2001 From: printempw Date: Sat, 6 Aug 2016 19:12:39 +0800 Subject: [PATCH] notify if password resetting is disabled --- app/Controllers/AuthController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php index b1dbb099..47be47f9 100644 --- a/app/Controllers/AuthController.php +++ b/app/Controllers/AuthController.php @@ -110,7 +110,11 @@ class AuthController extends BaseController public function forgot() { - View::show('auth.forgot'); + if ($_ENV['MAIL_HOST'] != "") { + View::show('auth.forgot'); + } else { + throw new E('本站已关闭重置密码功能', 8, true); + } } public function handleForgot() @@ -118,6 +122,9 @@ class AuthController extends BaseController if (strtolower(\Utils::getValue('captcha', $_POST)) != strtolower($_SESSION['phrase'])) View::json('验证码填写错误', 1); + if ($_ENV['MAIL_HOST'] == "") + View::json('本站已关闭重置密码功能', 1); + if (isset($_SESSION['last_mail_time']) && (time() - $_SESSION['last_mail_time']) < 60) View::json('你邮件发送得太频繁啦,过 60 秒后再点发送吧', 1);