diff --git a/app/Http/Home/Services/Account.php b/app/Http/Home/Services/Account.php index 929c30ac..8516bcad 100644 --- a/app/Http/Home/Services/Account.php +++ b/app/Http/Home/Services/Account.php @@ -53,9 +53,17 @@ class Account extends Service $validator->checkIfAllowLogin($user); - $validator = new CaptchaValidator(); + $captcha = $this->getSettings('captcha'); - $validator->checkCode($post['ticket'], $post['rand']); + /** + * 验证码是一次性的,放到最后检查,减少第三方调用 + */ + if ($captcha['enabled'] == 1) { + + $validator = new CaptchaValidator(); + + $validator->checkCode($post['ticket'], $post['rand']); + } $this->auth->saveAuthInfo($user); diff --git a/app/Services/Logic/Verify/MailCode.php b/app/Services/Logic/Verify/MailCode.php index 9a04d1dc..d3cb7768 100644 --- a/app/Services/Logic/Verify/MailCode.php +++ b/app/Services/Logic/Verify/MailCode.php @@ -23,9 +23,14 @@ class MailCode extends LogicService $post['email'] = $validator->checkEmail($post['email']); - $validator = new CaptchaValidator(); + $captcha = $this->getSettings('captcha'); - $validator->checkCode($post['ticket'], $post['rand']); + if ($captcha['enabled'] == 1) { + + $validator = new CaptchaValidator(); + + $validator->checkCode($post['ticket'], $post['rand']); + } $service = new MailVerifyService(); diff --git a/app/Services/Logic/Verify/SmsCode.php b/app/Services/Logic/Verify/SmsCode.php index c97dbd56..adcbb080 100644 --- a/app/Services/Logic/Verify/SmsCode.php +++ b/app/Services/Logic/Verify/SmsCode.php @@ -23,9 +23,14 @@ class SmsCode extends LogicService $post['phone'] = $validator->checkPhone($post['phone']); - $validator = new CaptchaValidator(); + $captcha = $this->getSettings('captcha'); - $validator->checkCode($post['ticket'], $post['rand']); + if ($captcha['enabled'] == 1) { + + $validator = new CaptchaValidator(); + + $validator->checkCode($post['ticket'], $post['rand']); + } $service = new SmsVerifyService();