cms
cms copied to clipboard
Route [password.reset] not defined when storing users in database.
I'm getting this when submitting the forgot password form:
Route [password.reset] not defined.
I tested on a fresh install. At first the password reset worked. Then after moving users to the database, I replicated the error.
Environment
Statamic version: 3.0.0.-beta-40
PHP version: 7.4
Install method (choose one):
- Fresh install from
statamic/statamic
Are password resets having an issue with users in DB still?
@twd3 you'll have to add your own routes to web.php.
I started with:
Auth::routes();
But, then customized as I needed.
You'll need to elaborate on what you're doing here.
Why are you adding Auth::routes()? What else are you doing? When exactly are you getting the error? What did you click on? On which URL?
@jasonvarga,
It's been a while now, but this was my experience:
- Follow the Statamic docs to move users to a database
- Complete the forgot password form. I recall using the
/cp/auth/password/reset
form. - Error is returned:
Route [password.reset] not defined.
A lot of this is explained in PR 2417.
This is recreatable. Thanks!
A workaround for this is to add the following to your User model (probably app/User.php
)
public function sendPasswordResetNotification($token)
{
$this->notify(new \Statamic\Notifications\PasswordReset($token));
}
This issue has not had recent activity and has been marked as stale — by me, a robot. Simply reply to keep it open and send me away. If you do nothing, I will close it in a week. I have no feelings, so whatever you do is fine by me.
Just ran into this. Please keep open.
@johncarter- did you give the workaround posted above a try?
Yeah I did and can confirm it works. I thought it would be good to open it back up if people are stilling running into it though.
Awesome, I agree it should either get built in or mentioned on the knowledge base article
Just ran into this issue as well. The workaround above still works as some Laravel 8 and Statamic 3.0.46
An extra paragraph or two on the article @jeremydouglas mentioned would probably be a good idea. I'm heads down in a project right now but I'll try to come back if I have time in a week or two.
I have also run into this using Laravel 8 and Statamic 3.2.10
The workaround https://github.com/statamic/cms/issues/2133#issuecomment-693770781 works, however it seems to generate password reset links only with http even if the form was submitted via https which ends up in a session mismatch. Looking further into that.
[edit] the https issue seems to be due to using ngrok locally for some oauth testing and the symfony request root() scheme determination. An annoyance, but not an issue for production.
@daronspence @beck24 give this an issue a 👍 so the core team can place it properly in the priority list.
A workaround for this is to add the following to your User model (probably
app/User.php
)public function sendPasswordResetNotification($token) { $this->notify(new \Statamic\Notifications\PasswordReset($token)); }
Jason, should this go in the statamic/statamic
repo so that folks at least have a working version?
I ran into the same initial issue described by @jeremydouglas on a fresh install and following the steps to move users from file to DB.
Adding sendPasswordResetNotification method into User model seems to work fine.
Would be nice if this is added to the Storing Users in a Database.
It's crazy that after 2 years that this hasn't been added to the docs yet. I understand that if it's too complicated to fix in the core, but it creates a hugely painful developer experience when you all of a sudden have half of the CMS authentication functionality break when you move to eloquent-based users (which is required quite often).
Are the docs open source? If so, can someone link me to them and I'll open a PR
Of course, go to the page you think it should be on and click this:
@edalzell Thanks, I clearly didn't scroll down far enough!
https://github.com/statamic/docs/pull/926
I'm closing this now since the workaround has since been added to the documentation.
request()->validate([
'email' => 'required|email'
]);
$status = Password::sendResetLink(
request()->only('email')
);
return $status === Password::RESET_LINK_SENT
? back()->with(['status' => __($status)])
: back()->withErrors(['email' => __($status)]);
I have multi roler based authentication so i need to override the default route password.reset based on user type. how i fix it
This issue has been closed for six months.
Please open a discussion if you're looking for help in customizing Statamic.