-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean up error handling for local auth bypass
- Loading branch information
1 parent
b0524f0
commit 0337937
Showing
1 changed file
with
4 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,8 +68,9 @@ export async function middleware(request: NextRequest) { | |
password: dummyPassword | ||
}); | ||
if (signUpError) { | ||
console.error(signInError); | ||
throw(signUpError); | ||
console.error('Sign-in error:', signInError); | ||
console.error('Sign-up error:', signUpError); | ||
throw new Error('Failed to handle local development auth bypass.'); | ||
} | ||
} | ||
return response | ||
|
@@ -79,7 +80,7 @@ export async function middleware(request: NextRequest) { | |
} = await supabase.auth.getUser(); | ||
|
||
const allowedPathsRegex = new RegExp(`^(/|/login|/auth/callback|/docs/.+)$`); | ||
if ((!user || user.email === '[email protected]') && !allowedPathsRegex.test(request.nextUrl.pathname)) { | ||
if (!user && !allowedPathsRegex.test(request.nextUrl.pathname)) { | ||
const url = request.nextUrl.clone(); | ||
url.pathname = `/404`; | ||
return NextResponse.rewrite(url); | ||
|