Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined variable: request in reset-password.blade.php #57

Closed
BlogProgWEB opened this issue Sep 18, 2020 · 2 comments
Closed

Undefined variable: request in reset-password.blade.php #57

BlogProgWEB opened this issue Sep 18, 2020 · 2 comments

Comments

@BlogProgWEB
Copy link

BlogProgWEB commented Sep 18, 2020

  • Fortify Version: 8.4.0
  • Laravel Version: 8.4.0
  • PHP Version: 7.3.9
  • Database Driver & Version: 5.7.x

Description:

Undefined variable: request in reset-password.blade.php when I override view forgot-password

Steps To Reproduce:

Clean installation Laravel Framework 8.4.0 without any auth scaffolding.

Db migration and seed - it's ok!

Then:

composer require laravel/fortify

and php artisan vendor:publish...

php artisan migrate

It's ok!

Created in FortifyServiceProvider in boot() :

Fortify::requestPasswordResetLinkView(function () {  
  return view('admin.auth.forgot-password');  
});  
  
Fortify::resetPasswordView(function () {  
  return view('admin.auth.reset-password');  
});

And created views in view/admin/auth folder:
forgot-password.blade.php

<form method="POST" action="/forgot-password">  
  @csrf  
  <input id="email" type="email" name="email" value="{{ old('email') }}" required>  
  <button type="submit">  
  {{ __('Send Password Reset Link') }}  
  </button>  
</form>

reset-password.blade.php

<form method="POST" action="/reset-password">  
  @csrf  
  <input type="hidden" name="token" value="{{ $request->route('token') }}">  
</form>

Then in browser /forgot-password Send Password Reset Link

From mail go to link /reset-password/543c9a...hash?email=admin%40example.com

I get

ErrorException
Undefined variable: request (View: ...\resources\views\admin\auth\reset-password.blade.php)`

It also doesn't work if I am using Jetstream and want to override the view forgot-password in JetstreamServiceProvider in boot() and sets any folder.

Even if I only specify this, I will not change anything else from a clean install (liveware).

Fortify::requestPasswordResetLinkView(static function () {
    return view('auth.forgot-password');
});
@BlogProgWEB
Copy link
Author

Maybe this is not a wrong, and I didn't read something in the documentation or did I do it wrong?

@driesvints
Copy link
Member

Docs are missing this:

Fortify::resetPasswordView(function ($request) {  
  return view('admin.auth.reset-password', ['request' => $request]);  
});

I'll send in a PR. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants