无法在本地使用Laravel重置密码

时间:2018-09-18 08:19:44

标签: laravel authentication

resources/views/layouts/app.blade.php

<meta name="csrf-token" content="{{ csrf_token() }}">

/password/reset

# resources/views/auth/passwords/email.blade.php
<form role="form" method="POST" action="{{ route('password.email') }}">
  {{ csrf_field() }}

  <input id="email" type="email" name="email" value="{{ old('email') }}" required>

  <button type="submit">
    Send Reset Link
  </button>
</form>

发布到/password/reset后,我遇到了TokenMismatchException错误:

Page showing default laravel 5.4 TokenMismatchException

路线:

$ php artisan route:list | grep password
| account.local.mysite.com | POST                           | password/email                                  | password.email                    | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail  | web,ip,guest                  |
| account.local.mysite.com | POST                           | password/reset                                  |                                   | App\Http\Controllers\Auth\ResetPasswordController@reset                | web,ip,guest                  |
| account.local.mysite.com | GET|HEAD                       | password/reset                                  | password.request                  | App\Http\Controllers\Auth\ForgotPasswordController@showLinkRequestForm | web,ip,guest                  |
| account.local.mysite.com | GET|HEAD                       | password/reset/{token}                          | password.reset                    | App\Http\Controllers\Auth\ResetPasswordController@showResetForm        | web,ip,guest

.env

APP_ENV=local
APP_KEY=base64:asffwl8j+2xW+LOzTIPcsO0XsMdwjeijKo6ktLyrpI=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_SCHEME=http

添加了前5行的.env文件。它包含APP_KEY,但是为什么在php artisan tinker下找不到?

怎么了?

1 个答案:

答案 0 :(得分:0)

清除这些选项并清除浏览器缓存后,它即可工作。

php artisan config:clear
php artisan clear
php artisan cache:clear
php artisan auth:clear-resets
php artisan view:clear