From 590f62d0357aad457cba29204f0bac8cbfd8b777 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Sun, 15 Jul 2018 18:18:56 +0800 Subject: [PATCH] use mail.driver to determine whether password reset is disabled --- app/Http/Controllers/AuthController.php | 4 ++-- tests/AuthControllerTest.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 738d1ad9..ad26fe80 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -157,7 +157,7 @@ class AuthController extends Controller public function forgot() { - if (config('mail.host') != "") { + if (config('mail.driver') != "") { return view('auth.forgot'); } else { throw new PrettyPageException(trans('auth.forgot.close'), 8); @@ -169,7 +169,7 @@ class AuthController extends Controller if (! $this->checkCaptcha($request)) return json(trans('auth.validation.captcha'), 1); - if (config('mail.host') == "") + if (config('mail.driver') == "") return json(trans('auth.forgot.close'), 1); if (Session::has('last_mail_time') && (time() - session('last_mail_time')) < 60) diff --git a/tests/AuthControllerTest.php b/tests/AuthControllerTest.php index 1f22edfa..e2c17ca3 100644 --- a/tests/AuthControllerTest.php +++ b/tests/AuthControllerTest.php @@ -396,7 +396,7 @@ class AuthControllerTest extends TestCase { $this->get('/auth/forgot')->assertSee('Forgot Password'); - config(['mail.host' => '']); + config(['mail.driver' => '']); $this->get('/auth/forgot')->assertSee(trans('auth.forgot.close')); } @@ -413,14 +413,14 @@ class AuthControllerTest extends TestCase ]); // Should be forbidden if "forgot password" is closed - config(['mail.host' => '']); + config(['mail.driver' => '']); $this->withSession(['phrase' => 'a'])->postJson('/auth/forgot', [ 'captcha' => 'a' ])->assertJson([ 'errno' => 1, 'msg' => trans('auth.forgot.close') ]); - config(['mail.host' => 'localhost']); + config(['mail.driver' => 'smtp']); // Should be forbidden if sending email frequently $this->withSession(['last_mail_time' => time()])->postJson('/auth/forgot', [