chore: [app-router-migration 34] migrate the "/auth/logout" and "/auth/signin" pages (#13199)
## What does this PR do? - This PR migrates the `/auth/logout` and `/auth/signin` pages to the app directory (which runs under the App Router). - Using `/future/auth/logout` is available at all times and is supposed to log the user out as `/auth/logout` page does. - However `signin` page (or fragment) was used before should behave the same using the `/future/auth/signin` route. ## Requirement/Documentation - If there is a requirement document, please, share it here. - If there is ab UI/UX design document, please, share it here. ## Type of change - [x] Chore (refactoring code, technical debt, workflow improvements) - [x] New feature (non-breaking change which adds functionality) ## How should this be tested? - Using `/future/auth/logout` is available at all times and is supposed to log the user out as `/auth/logout` page does. - However `signin` page (or fragment) was used before should behave the same using the `/future/auth/signin` route. It was not tested locally. ## Mandatory Tasks - [x] Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.
This commit is contained in:
1 parent
b268540d35
commit
41efb5ea04
7 files changed
+83
-43
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import { get } from "@vercel/edge-config";
|
||||
import { collectEvents } from "next-collect/server";
|
||||
import { cookies } from "next/headers";
|
||||
import type { NextRequest } from "next/server";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
@@ -81,6 +82,10 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
|
||||
}
|
||||
}
|
||||
|
||||
if (url.pathname.startsWith("/future/auth/logout")) {
|
||||
cookies().delete("next-auth.session-token");
|
||||
}
|
||||
|
||||
requestHeaders.set("x-pathname", url.pathname);
|
||||
|
||||
const locale = await getLocale(req);
|
||||
@@ -112,6 +117,7 @@ export const config = {
|
||||
"/api/trpc/:path*",
|
||||
"/login",
|
||||
"/auth/login",
|
||||
"/future/auth/login",
|
||||
/**
|
||||
* Paths required by routingForms.handle
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user