在 Laravel 4.2 中休息密码



所以我在休息密码页面遇到了问题,一旦你输入电子邮件并单击发送,用户就会正确收到电子邮件,但是当用户进入休息密码页面并输入所有信息时,密码将无法正确休息。

  • 检查解决方案帖子。

谢谢

***更新:

完整控制器代码:

<?php
use CareFormsReminderForm;
class RemindersController extends Controller
{
    protected $reminderForm;
    function __construct(ReminderForm $reminderForm)
    {
        $this->reminderForm = $reminderForm;
    }
    public function getRemind()
    {
        return View::make('pages.remind');
    }
public function postRemind()
{
    $this->reminderForm->validate(Input::only('email'));
    $response = Password::remind(Input::only('email'), function($message)
    {
        $message->subject('Rest password');
    });
    switch ($response) {
        case Password::INVALID_USER:
            return Redirect::back()->with('error', Lang::get($response));
        case Password::REMINDER_SENT:
            return Redirect::back()->with('status', Lang::get($response));
    }
}
    public function getReset($token = null)
    {
        if (is_null($token)) App::abort(404);
        return View::make('pages.reset')->with('token', $token);
    }
    public function postReset()
    {
        $credentials = Input::only(
            'email', 'password', 'password_confirmation', 'token'
        );
        $response = Password::reset($credentials, function ($user, $password) {
            $user->password = $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更改此行:从:

$user->password = Hash::make($password);

自:

    $user->password = $password;

这应该可以解决您的问题。

相关内容

  • 没有找到相关文章

最新更新