I have a NextJS app with a login page. If the user enters a email that is not linked to an existing account, I want to show a button to redirect the user to the signup page.
Ideally, I would like the email and password entered in the login page to be pre-filled in the signup page.
I currently show a link:
<Link
href={{
pathname: '/signup',
query: {
email,
password
},
}}
as={'/signup'}
passHref
>
Go to signup
</Link>
The entered email and password are in the query params, but thanks to the as='/signup' property, they don't show in the browser address bar.
In my signup page I can fetch them using:
const {
query: {
email,
password
}
} = useRouter()
I'm wondering if this is safe and a good practice, or if there is a better way?
[EDIT] Would it be safe to temporarily use sessionstorage?