I have an Angular web app where to sign up you go through different pages:
- Fill in your name and email
- Fill in your password
- Fill in your confirmation code
Hence the URL changes from website.com/intake
to website.com/intake/signup
to website.com/intake/confirmation
.
My problem is that it is currently possible for a user to change the url from website.com/intake
to website.com/intake/signup
and finish the registration without filling the other information. I would like to prevent that but I am not sure how to use routing in this case.
I want to make sure that the user can go to the next page only if he has been to the first one and has filled in. Now I know, if I make the form fields * required
it will not allow the user to go further but he will still be able to bypass that by changing the URL.
How do I solve that?
CodePudding user response:
You can use guards. Create a conditional to restrict the route you wish.
If the user hasn't filled the form, redirect him to the form.