mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-15 06:09:58 +08:00
use mail.driver to determine whether password reset is disabled
This commit is contained in:
parent
5a0908517e
commit
590f62d035
@ -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)
|
||||
|
@ -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', [
|
||||
|
Loading…
Reference in New Issue
Block a user