Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
Add email next to token in Laravel forgot password template email link

I'm using Laravel 8.5 with authentication system. When user wants to change password it sends an email with link. Default email contains link which looks like this:

http://mywebsite/api/forgot-password?token=2ccece360b031db4dcadea0cbdf8dd47a1712632b727487a7226f19f8f607cc7&email=MyEmail%40gmail.com

I did some changes in email template. In ResetPasswordNotification.php I added this:

public function toMail($notifiable)
    {
        return (new MailMessage)
                    ->subject('MyApp password reset')
                    ->line('You are receiving this email because we received a password reset request for your account.')
                    ->action('Reset Password', $this->url)
                    ->line('This password reset link will expire in 60 minutes.')                    
                    ->line('If you did not request a password reset, no further action is required.');
    }

and in User.php I have:

public function sendPasswordResetNotification($token)
    {    
        $url = 'http://mywebsite/en/change-password?token=' . $token;    
        $this->notify(new ResetPasswordNotification($url));
    }

and now I receive this link:

http://mywebsite/en/change-password?token=8f87fc2d504507as385b4c47cb015cee4192749d3f1d641863524d513abb2a39

which only contains token and not email. How do I add email to this so it would look something like this:

http://mywebsite/en/change-password?token=8f87fc2d504507as385b4c47cb015cee4192749d3f1d641863524d513abb2a39&email=UserEmail@gmail.com
over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Try passing email to the url.

public function sendPasswordResetNotification($token)
{    
    $url = 'http://mywebsite/en/change-password?token=' . $token . '&email=' .$this->email;    
    $this->notify(new ResetPasswordNotification($url));
}
over 4 years ago · Santiago Trujillo Report

0

Just add $this->email next to $token.

public function sendPasswordResetNotification($token)
{    
    $url = 'http://mywebsite/en/change-password?token=' . $token . '&email=' . $this->email;    
    $this->notify(new ResetPasswordNotification($url));
}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!