From 7c05f5f70e701e6f63da28029cffab06e9a6c522 Mon Sep 17 00:00:00 2001 From: wood chen Date: Thu, 20 Feb 2025 03:13:04 +0800 Subject: [PATCH] feat: Enhance OAuth authorization error handling with ErrorCard - Add comprehensive error handling for invalid clients, disabled applications, and mismatched redirect URIs - Implement ErrorCard component to display detailed error messages during OAuth authorization - Improve user feedback with specific error types and descriptions - Replace simple error text with structured error handling --- src/app/(oauth)/oauth/authorize/page.tsx | 39 +++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/app/(oauth)/oauth/authorize/page.tsx b/src/app/(oauth)/oauth/authorize/page.tsx index b3cf9cf..00c54c1 100644 --- a/src/app/(oauth)/oauth/authorize/page.tsx +++ b/src/app/(oauth)/oauth/authorize/page.tsx @@ -3,6 +3,7 @@ import { redirect } from "next/navigation"; import { getClientByClientId } from "@/lib/dto/client"; import { getCurrentUser } from "@/lib/session"; import { Authorizing } from "@/components/auth/authorizing"; +import { ErrorCard } from "@/components/auth/error-card"; export interface AuthorizeParams { oauth: string; @@ -25,7 +26,43 @@ export default async function AuthorizePage({ if (!client) { return (
-
应用不存在
+ +
+ ); + } + + // 检查应用是否被禁用 + if (!client.enabled) { + return ( +
+ +
+ ); + } + + // 检查回调地址是否匹配 + if (client.redirectUri !== searchParams.redirectUri) { + return ( +
+
); }