Recent Topics

reset password email issue



  • Hello,

    When i am using forgot password then it sends an email. via email an reset password link also comes. but when i click on this link to takes me to reset password template.

    there email fields is also there but i am unable to find how are you passing email in reset template.

    public function create(Request $request, $token = null)
    {
    return view($this->_config['view'])->with(
    ['token' => $token, 'email' => $request->email]
    );
    }
    in above function how are you using $request->email ?

    can you tell me how can i send email variable from here.

    Regards
    Deepak Sharma



  • Hello deepak,

    To send email variable to template, follow below steps :

    1)Go to Webkul\Customer\src\Notifications\CustomerResetPassword. Replace toMail function with below code

    public function toMail($notifiable)
        {
            if (static::$toMailCallback) {
                return call_user_func(static::$toMailCallback, $notifiable, $this->token);
            }
    
            return (new MailMessage)
                ->subject(__('shop::app.mail.forget-password.subject') )
                ->view('shop::emails.customer.forget-password', [
                    'user_name' => $notifiable->name,
                    'email' => $notifiable->email,
                    'token' => $this->token
                ]);
        }
    
    1. Go to views\emails\customer\forget-password.blade.php of Shop package, pass email in route as below
    <a href="{{ route('customer.reset-password.create', ['token' => $token, 'email' => $email]) }}" style="padding: 10px 20px;background: #0041FF;color: #ffffff;text-transform: uppercase;text-decoration: none; font-size: 16px">
    {{ __('shop::app.mail.forget-password.reset-password') }}
     </a>
    

    3)Now, in your ResetPasswordController, you can get email in $request



  • @dsharma
    please can you help me to solve the problem of the email not sent to reset password and help me to set the configration in the right place of env file



  • @Ahed
    Please configure your credentails here


Log in to reply