I want to make it, so when you enter the site, you have to input a password. Also, I want to make it so if you try to access anything else than /password you are redirected back to the password page. I'm using a form and cookies.
This piece of code breaks everything (the css doesn't work and when I try to submit the password, it doesn't show any alert or anything, just removes the text from the placeholder and it seems to refresh). But when I remove it, everything works fine, but there is just no redirection.
if (!authCookie && url.pathname !== '/password') {
url.pathname = '/password';
return NextResponse.redirect(url);
}
The thing I'm trying to achieve is: If the user didn't input the password, keep redirecting him to the /password page, and make the /password page work