login
This commit is contained in:
@@ -5,6 +5,21 @@ type ProxyOptions = {
|
||||
stripAuth?: boolean;
|
||||
};
|
||||
|
||||
const PUBLIC_AUTH_PATTERNS = [
|
||||
/^\/login\/?$/,
|
||||
/^\/login\/verify$/,
|
||||
/^\/login\/login_username$/,
|
||||
/^\/login\/forgot_password$/,
|
||||
/^\/register\/?$/,
|
||||
/^\/register\/verify$/,
|
||||
/^\/auth\/google$/,
|
||||
];
|
||||
|
||||
export function isPublicAuthPath(pathSegments: string[]): boolean {
|
||||
const path = `/${pathSegments.join("/")}`;
|
||||
return PUBLIC_AUTH_PATTERNS.some((pattern) => pattern.test(path));
|
||||
}
|
||||
|
||||
export async function proxyToUpstream(
|
||||
req: Request,
|
||||
upstreamPath: string,
|
||||
@@ -43,8 +58,3 @@ export async function proxyToUpstream(
|
||||
headers: responseHeaders,
|
||||
});
|
||||
}
|
||||
|
||||
export function isPublicAuthPath(pathSegments: string[]): boolean {
|
||||
const path = pathSegments.join("/");
|
||||
return path.startsWith("login") || path.startsWith("register");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user