mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-16 21:33:41 +00:00
feat: remove legacy "data_unlocked" field
This commit is contained in:
@@ -465,12 +465,12 @@ export function registerUserWebAuthnRoutes(
|
||||
}
|
||||
|
||||
const deviceInfo = parseUserAgent(req);
|
||||
const dataUnlocked = await authManager.authenticateWebAuthnUser(
|
||||
const authenticated = await authManager.authenticateWebAuthnUser(
|
||||
userRecord.id,
|
||||
deviceInfo.type,
|
||||
);
|
||||
|
||||
if (!dataUnlocked) {
|
||||
if (!authenticated) {
|
||||
return res.status(401).json({
|
||||
error:
|
||||
"Passkey cannot unlock this account. Log in with password and register the passkey again.",
|
||||
@@ -530,7 +530,6 @@ export function registerUserWebAuthnRoutes(
|
||||
userId: userRecord.id,
|
||||
is_oidc: !!userRecord.isOidc,
|
||||
totp_enabled: !!userRecord.totpEnabled,
|
||||
data_unlocked: true,
|
||||
...(isNativeAppRequest(req) ? { token } : {}),
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@@ -1510,21 +1510,21 @@ router.post("/login", async (req, res) => {
|
||||
|
||||
const deviceInfo = parseUserAgent(req);
|
||||
|
||||
let dataUnlocked = false;
|
||||
let authenticated = false;
|
||||
if (userRecord.isOidc) {
|
||||
dataUnlocked = await authManager.authenticateOIDCUser(
|
||||
authenticated = await authManager.authenticateOIDCUser(
|
||||
userRecord.id,
|
||||
deviceInfo.type,
|
||||
);
|
||||
} else {
|
||||
dataUnlocked = await authManager.authenticateUser(
|
||||
authenticated = await authManager.authenticateUser(
|
||||
userRecord.id,
|
||||
password,
|
||||
deviceInfo.type,
|
||||
);
|
||||
}
|
||||
|
||||
if (!dataUnlocked) {
|
||||
if (!authenticated) {
|
||||
return res.status(401).json({ error: "Incorrect password" });
|
||||
}
|
||||
|
||||
@@ -1771,7 +1771,6 @@ router.get("/me", authenticateJWT, async (req: Request, res: Response) => {
|
||||
is_oidc: !!user.isOidc,
|
||||
is_dual_auth: isDualAuth,
|
||||
totp_enabled: !!user.totpEnabled,
|
||||
data_unlocked: authManager.isUserUnlocked(userId),
|
||||
});
|
||||
} catch (err) {
|
||||
authLogger.error("Failed to get username", err);
|
||||
|
||||
@@ -188,7 +188,6 @@ export interface AuthResponse {
|
||||
userId?: string;
|
||||
is_oidc?: boolean;
|
||||
totp_enabled?: boolean;
|
||||
data_unlocked?: boolean;
|
||||
requires_totp?: boolean;
|
||||
temp_token?: string;
|
||||
rememberMe?: boolean;
|
||||
@@ -201,7 +200,6 @@ export interface UserInfo {
|
||||
username: string;
|
||||
is_admin: boolean;
|
||||
is_oidc: boolean;
|
||||
data_unlocked: boolean;
|
||||
password_hash?: string;
|
||||
}
|
||||
|
||||
@@ -1716,7 +1714,6 @@ export async function loginUser(
|
||||
rememberMe: response.data.rememberMe,
|
||||
is_oidc: response.data.is_oidc,
|
||||
totp_enabled: response.data.totp_enabled,
|
||||
data_unlocked: response.data.data_unlocked,
|
||||
token: response.data.token,
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user