phplaravellaravel-8reset-password

reset password link is not redirecting to reset password page in laravel


In my website firstly it was working and suddenly yesterday i got this bug where steps are as follows

  1. request for reset password
  2. when received mail click on reset password
  3. I get following link to reset my password on reset password button http://sitename.com/password/reset/3f9674ddbe57a2f3f1b94495e9b1cc94593b7e0f861d92eb534739a47f2f2f34?email=vishal%40gmail.com

but clicking hitting that link used to get redirected to home page of the website with following url https://sitename.com/index.php?email=vishal%40gamil.com

Resetpassword.php

public function toMail($notifiable)
    {
        if (static::$toMailCallback) {
            return call_user_func(static::$toMailCallback, $notifiable, $this->token);
        }

        return (new MailMessage)
            ->subject(Lang::getFromJson('Password Password'))
            ->line(new HtmlString("<h1 style='text-align: center;'>Password Reset</h1>"))
            ->line(new HtmlString("<center>You have requestd a password reset <br /> Please click the button below to reset your password</center>"))
            ->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', ['token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset()], false)))
            ->line(Lang::getFromJson('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')]))
            ->line(Lang::getFromJson('If you did not request a password reset, no further action is required.'));
    }

reset_token_generator.php

 public function sendPasswordResetNotification($token)
{
    $this->notify(new ResetPasswordNotification($token));
}

why is this happening all of a sudden


Solution

  • i got the solution in .env file i just replace my website name with following

    app_name= websitename.com to app_name= www.websitename.com

    i didn't get what was the issue but this one worked for me

    if someone knows the reason i will be glad to know that