Reputation: 2503
I am setting up a password reminder feature in my laravel 4.1 app and everything seems to work find till when I submit the reset form. When I submit the password reset form, I get this error:
ErrorException
Trying to get property of non-object
open: C:\\xampp\WWW\myApp\vendor\laravel\framework\src\Illuminate\Auth\Reminders\DatabaseReminderRepository.php
The manual is my guide. I have successfully send the reset link via e-mail and got the form through the link. But the above error arise upon submission of the form. Please help. Thanks.
OK. This is my code in the Remind Controller responsible for password reset.
public function postReset()
{
$credentials = Input::only(
'email', 'password', 'password_confirmation', 'token'
);
$response = Password::reset($credentials, function($user, $password)
{
$user->password = Hash::make($password);
$user->save();
});
switch ($response)
{
case Password::INVALID_PASSWORD:
case Password::INVALID_TOKEN:
case Password::INVALID_USER:
return Redirect::back()->with('error', Lang::get($response));
case Password::PASSWORD_RESET:
return Redirect::to('/');
}
}
NB: it was generate using php art... auth:reminders-controller according to the laravel doc. Thanks for making the comments.
Upvotes: 0
Views: 315
Reputation: 24
I review my DatabaseReminderRepository.php
I checked $reminder with dd($reminder) and bring me an array so i've change with $reminder['created_at'];
protected function reminderExpired($reminder) {
// this $reminder->created_at into this $reminder['created_at']
// $createdPlusHour = strtotime($reminder->created_at) + $this->expires;
$createdPlusHour = strtotime($reminder['created_at']) + $this->expires;
return $createdPlusHour < $this->getCurrentTime();
}
Upvotes: 1