Building Register Page
In this lesson, we will build the register page with a form that allows users to enter an email, a password, and a password confirmation.
We will pretty much do the same things we did with the login page, but with a few differences. Expect this lesson to be quick. In case, you need more explanation, you can ask us in the Discord community.
Register Page
To save you some time and not repeat the same steps, we will give you the entire code for the register page and the action. You can copy and paste it into your project.
Here is the server action code:
You will see two differences in the register action compared to the login action:
- We use
refine
to check if the password and the confirm password match, thepath
property is used to customize the error path a.k.a which field the error should be shown on. - We use
supabase.auth.signUp
instead ofsupabase.auth.signIn
.
Everything else is the same.
Link the home page to the register page
All that is left is to link the home page to the register page. We can do this by adding a link to the register page on the marketing landing page's header.
You can try to register a user now.
That is it for this chapter, we are ready to now test this whole flow in the next section.
At this point, our code should match the code in the branch 5-building-register-page
.
Last updated on