【发布时间】:2014-08-22 23:15:10
【问题描述】:
我正在我的 laravel 4.1 应用程序中设置密码提醒功能,在我提交重置表单之前,一切似乎都正常工作。当我提交密码重置表单时,我收到此错误:
ErrorException
Trying to get property of non-object
open: C:\\xampp\WWW\myApp\vendor\laravel\framework\src\Illuminate\Auth\Reminders\DatabaseReminderRepository.php
手册是我的指南。我已经通过电子邮件成功发送了重置链接,并通过链接获得了表格。但是在提交表单时会出现上述错误。请帮忙。谢谢。
好的。这是我在提醒控制器中负责密码重置的代码。
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('/');
}
}
注意:它是使用生成的 php art... auth:reminders-controller 根据 laravel doc。 感谢您制作 cmets。
【问题讨论】:
-
你能给我们更多的信息吗?表格提交后怎么办?你能告诉我们控制器吗?还是形式?信息不足以得出结论
-
是的,你确实需要展示一些代码,我们无法猜测你的代码是什么样子或者你在做什么。
-
我正在使用 mongoDb 作为我的数据库。