statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Password reset form doesn't set `url_invalid` variable #2509

Open aerni opened 4 years ago

aerni commented 4 years ago

Describe the bug The password reset form doesn't actually set a url_invalid variable when the request doesn't contain the user and code parameters.

The docs say it should:

Visiting the URL containing this form directly will set a url_invalid invalid variable you can use to check if they’ve actually come from the form in their previous request.

To Reproduce Steps to reproduce the behavior:

  1. Add a password reset form to a page
  2. Visit the page directly

Expected behavior Always return the url_invalid variable when visiting a page with the form

Potential Fix This fixed the problem for me:

// UserTags.php

if (! $user = User::find($id)) {
  // dd('Invalid user'); // @todo make better.
  return $this->parse(['url_invalid' => true]);
}

Environment details (please complete the following information):