Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda