oidc登录按钮支持自定义文字

This commit is contained in:
mtvpls
2025-12-13 17:36:57 +08:00
parent 822bb4a07e
commit d467c5067b
6 changed files with 34 additions and 3 deletions

View File

@@ -58,6 +58,7 @@ export async function POST(request: NextRequest) {
OIDCUserInfoEndpoint,
OIDCClientId,
OIDCClientSecret,
OIDCButtonText,
} = body as {
SiteName: string;
Announcement: string;
@@ -88,6 +89,7 @@ export async function POST(request: NextRequest) {
OIDCUserInfoEndpoint?: string;
OIDCClientId?: string;
OIDCClientSecret?: string;
OIDCButtonText?: string;
};
// 参数校验
@@ -120,7 +122,8 @@ export async function POST(request: NextRequest) {
(OIDCTokenEndpoint !== undefined && typeof OIDCTokenEndpoint !== 'string') ||
(OIDCUserInfoEndpoint !== undefined && typeof OIDCUserInfoEndpoint !== 'string') ||
(OIDCClientId !== undefined && typeof OIDCClientId !== 'string') ||
(OIDCClientSecret !== undefined && typeof OIDCClientSecret !== 'string')
(OIDCClientSecret !== undefined && typeof OIDCClientSecret !== 'string') ||
(OIDCButtonText !== undefined && typeof OIDCButtonText !== 'string')
) {
return NextResponse.json({ error: '参数格式错误' }, { status: 400 });
}
@@ -169,6 +172,7 @@ export async function POST(request: NextRequest) {
OIDCUserInfoEndpoint,
OIDCClientId,
OIDCClientSecret,
OIDCButtonText,
};
// 写入数据库

View File

@@ -73,7 +73,7 @@ export async function POST(request: NextRequest) {
);
}
let oidcSession;
let oidcSession: any;
try {
oidcSession = JSON.parse(oidcSessionCookie);
} catch {

View File

@@ -43,6 +43,7 @@ export async function GET(request: NextRequest) {
TurnstileSiteKey: config.SiteConfig.TurnstileSiteKey || '',
EnableOIDCLogin: config.SiteConfig.EnableOIDCLogin || false,
EnableOIDCRegistration: config.SiteConfig.EnableOIDCRegistration || false,
OIDCButtonText: config.SiteConfig.OIDCButtonText || '',
};
return NextResponse.json(result);
}