In this episode, we're making the user registration process smoother by automatically sending out a magic login link right after someone registers. Instead of just letting the user go to the login page and request a login link themselves, we're hooking in the same SendMagicLink
action we use during the login process and running it straight after creating the user.
We walk through how to inject and use the SendMagicLink
action, showing how simple it is to reuse our existing code. After registering the new user, we trigger the handle
method on our send link action, passing in the freshly registered user's email address. This instantly sends out the login email—no extra steps required.
To prove it all works, we go ahead and register a test user, watch the link get sent out automatically, and confirm that the sign-in happens as expected. It's a quick and convenient update that makes our registration flow a lot more user-friendly!