在Laravel 4.2中保密密码

时间:2017-05-19 18:30:00

标签: php email laravel-4

所以我在其余密码页面出现问题,一旦你输入电子邮件并点击发送,用户就可以正确收到电子邮件,但是当用户进入其余密码页面并输入所有信息时,密码就不会#39; t restst。

  • 检查解决方案帖子。

谢谢

***更新:

完整的控制器代码:

<?php
use Care\Forms\ReminderForm;
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('/');
        }
    }
}

1 个答案:

答案 0 :(得分:-1)

所以经过一些讨论之后就是解决方案:

在RemindersController.php中

更改此行: 来自:

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

为:

    $user->password = $password;

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