Run php artisan optimize:clear to clear all the caches
May 3, 2021
10
Level 1
Password reset link is pointing to old APP_URL
I changed the APP_URL from test domain extension to IP Address. But the password reset email is showing link with the previous APP_URL as the base url.
The following are steps that I have tried to solve this:
- Change APP_URL in .env file
- Change url in config/app.php to the ip address instead of env variable.
- Ran php artisan config:clear
- Ran php artisan cache:clear
How can I solve this?
Level 29
Hi, are you changing the APP_URL at local?
From the codes, vendor/laravel/framework/src/illuminate/Notifications/ResetPassword.php
The URL generated is using the helper route() which basically current appending the current domain with the URL defined in the web.php
public function toMail($notifiable)
{
if (static::$toMailCallback) {
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
}
if (static::$createUrlCallback) {
$url = call_user_func(static::$createUrlCallback, $notifiable, $this->token);
} else {
$url = url(route('password.reset', [
'token' => $this->token,
'email' => $notifiable->getEmailForPasswordReset(),
], false));
}
return (new MailMessage)
->subject(Lang::get('Reset Password Notification'))
->line(Lang::get('You are receiving this email because we received a password reset request for your account.'))
->action(Lang::get('Reset Password'), $url)
->line(Lang::get('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.' . config('auth.defaults.passwords') . '.expire')]))
->line(Lang::get('If you did not request a password reset, no further action is required.'));
}
Please or to participate in this conversation.