diff --git a/src/Zizaco/Confide/EloquentPasswordService.php b/src/Zizaco/Confide/EloquentPasswordService.php index b0dc3a2..ffcae8e 100644 --- a/src/Zizaco/Confide/EloquentPasswordService.php +++ b/src/Zizaco/Confide/EloquentPasswordService.php @@ -172,9 +172,10 @@ protected function getOldestValidDate() // Instantiate a carbon object (that is a dependency of // 'illuminate/database') $carbon = $this->app['Carbon\Carbon']; + $config = $this->app['config']; return $carbon->now() - ->subHours(7) + ->subHours($config->get('confide::confide.password_reset_expiration', 7)) ->toDateTimeString(); } } diff --git a/src/config/config.php b/src/config/config.php index 8a6fc61..c21d319 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -75,20 +75,16 @@ /* |-------------------------------------------------------------------------- - | Signup (create) Cache + | Password reset expiration |-------------------------------------------------------------------------- | - | By default you will only can only register once every 2 hours - | (120 minutes) because you are not able to receive a registration - | email more often then that. - | - | You can adjust that limitation here, set to 0 for no caching. - | Time is in minutes. - | + | By default. A password reset request will expire after 7 hours. With the + | line below you will be able to customize the duration of the reset + | requests here. | */ - 'signup_cache' => 120, - + 'password_reset_expiration' => 7, // hours + /* |-------------------------------------------------------------------------- | Signup E-mail and confirmation (true or false) @@ -106,7 +102,7 @@ | signup_confirm: | is to decide of a member needs to be confirmed before he is able to login | so when you set this to true, then a member has to be confirmed before - | he is able to login, so if you want to use an IPN for confirmation, be + | he is able to login, so if you want to use an IPN for confirmation, be | sure that the ipn process also changes the confirmed flag in the member | table, otherwise they will not be able to login after the payment. | diff --git a/tests/Zizaco/Confide/EloquentPasswordServiceTest.php b/tests/Zizaco/Confide/EloquentPasswordServiceTest.php index 7366bba..5805df1 100644 --- a/tests/Zizaco/Confide/EloquentPasswordServiceTest.php +++ b/tests/Zizaco/Confide/EloquentPasswordServiceTest.php @@ -411,10 +411,12 @@ public function testShouldGetOldestValidDate() */ $oldestValidDate = '2014-07-16 22:20:26'; $carbon = m::mock('Carbon\Carbon'); + $config = m::mock('Config'); $passService = m::mock('Zizaco\Confide\EloquentPasswordService'); $passService->shouldAllowMockingProtectedMethods(); $passService->app['Carbon\Carbon'] = $carbon; + $passService->app['config'] = $config; /* |------------------------------------------------------------ @@ -424,11 +426,15 @@ public function testShouldGetOldestValidDate() $passService->shouldReceive('getOldestValidDate') ->passthru(); + $config->shouldReceive('get') + ->once()->with('confide::confide.password_reset_expiration', 7) + ->andReturn(14); + $carbon->shouldReceive('now') ->once()->andReturn($carbon); $carbon->shouldReceive('subHours') - ->once()->with(7) + ->once()->with(14) ->andReturn($carbon); $carbon->shouldReceive('toDateTimeString')