修改登录逻辑
This commit is contained in:
1 parent
fe66794168
commit
53b1842de8
12 files changed
+198
-28
No files matched your search
@@ -21,10 +21,6 @@ type PasswordTokenResponse = {
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const config = getAuthRuntimeConfig();
|
||||
if (!config.configured || !config.tokenUrl || !config.clientSecret || !config.sessionSecret) {
|
||||
throw new PasswordLoginError(`认证配置不完整:${config.missing.join(", ") || "未知配置"}`, 500);
|
||||
}
|
||||
const body = await readJsonBody<{
|
||||
username?: string;
|
||||
password?: string;
|
||||
@@ -33,7 +29,12 @@ export async function POST(request: Request) {
|
||||
code?: string;
|
||||
randomStr?: string;
|
||||
next?: string;
|
||||
authMode?: string;
|
||||
}>(request);
|
||||
const config = getAuthRuntimeConfig({ clientMode: body.authMode === "admin" ? "admin" : "default" });
|
||||
if (!config.configured || !config.tokenUrl || !config.clientSecret || !config.sessionSecret) {
|
||||
throw new PasswordLoginError(`认证配置不完整:${config.missing.join(", ") || "未知配置"}`, 500);
|
||||
}
|
||||
const username = body.username?.trim();
|
||||
const password = body.password || "";
|
||||
const code = body.code?.trim();
|
||||
|
||||
Reference in new issue
Block a user