oidc登录按钮支持自定义文字
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
// 写入数据库
|
||||
|
||||
@@ -73,7 +73,7 @@ export async function POST(request: NextRequest) {
|
||||
);
|
||||
}
|
||||
|
||||
let oidcSession;
|
||||
let oidcSession: any;
|
||||
try {
|
||||
oidcSession = JSON.parse(oidcSessionCookie);
|
||||
} catch {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user