How to get a registration token?

After the user has registered, I need to provide a link that the user can use to resend his registration.

How should I pass the token in the link, how do I generate this token?

ex: http://dmain.com/account/confirm/resend/:token

Besides, in RegistersUsers

public function register(RegisterRequest $request)
    {
        if (config('access.users.confirm_email')) {
            $user = $this->user->create($request->all());
            event(new UserRegistered($user));
            return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend'));
        } else {
            auth()->login($this->user->create($request->all()));
            event(new UserRegistered(access()->user()));
            return redirect($this->redirectPath());
        }
    }

So, the link is created as:

return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend'));

How to transfer a token to a trance?

'resend' => 'Your account is not confirmed. Please click the confirmation link in your e-mail, or <a href="' . route('account.confirm.resend', ':token') . '">click here</a> to resend the confirmation e-mail.',
+4
source share
2 answers

I found how to do this by passing the variable as an array as follows:

return redirect()->route('frontend.index')->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.resend', array('token' => $token)));
+1
source

You can save _token to receive a request during registration (token is generated using csrf_token () in the form). And this token can be sent to the link to verify the user.

0

All Articles