feat: remove legacy "data_unlocked" field

This commit is contained in:
LukeGus
2026-07-16 14:49:35 -05:00
parent f3a4d5662c
commit 552ceefec2
3 changed files with 6 additions and 11 deletions
@@ -465,12 +465,12 @@ export function registerUserWebAuthnRoutes(
} }
const deviceInfo = parseUserAgent(req); const deviceInfo = parseUserAgent(req);
const dataUnlocked = await authManager.authenticateWebAuthnUser( const authenticated = await authManager.authenticateWebAuthnUser(
userRecord.id, userRecord.id,
deviceInfo.type, deviceInfo.type,
); );
if (!dataUnlocked) { if (!authenticated) {
return res.status(401).json({ return res.status(401).json({
error: error:
"Passkey cannot unlock this account. Log in with password and register the passkey again.", "Passkey cannot unlock this account. Log in with password and register the passkey again.",
@@ -530,7 +530,6 @@ export function registerUserWebAuthnRoutes(
userId: userRecord.id, userId: userRecord.id,
is_oidc: !!userRecord.isOidc, is_oidc: !!userRecord.isOidc,
totp_enabled: !!userRecord.totpEnabled, totp_enabled: !!userRecord.totpEnabled,
data_unlocked: true,
...(isNativeAppRequest(req) ? { token } : {}), ...(isNativeAppRequest(req) ? { token } : {}),
}); });
} catch (error) { } catch (error) {
+4 -5
View File
@@ -1510,21 +1510,21 @@ router.post("/login", async (req, res) => {
const deviceInfo = parseUserAgent(req); const deviceInfo = parseUserAgent(req);
let dataUnlocked = false; let authenticated = false;
if (userRecord.isOidc) { if (userRecord.isOidc) {
dataUnlocked = await authManager.authenticateOIDCUser( authenticated = await authManager.authenticateOIDCUser(
userRecord.id, userRecord.id,
deviceInfo.type, deviceInfo.type,
); );
} else { } else {
dataUnlocked = await authManager.authenticateUser( authenticated = await authManager.authenticateUser(
userRecord.id, userRecord.id,
password, password,
deviceInfo.type, deviceInfo.type,
); );
} }
if (!dataUnlocked) { if (!authenticated) {
return res.status(401).json({ error: "Incorrect password" }); 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_oidc: !!user.isOidc,
is_dual_auth: isDualAuth, is_dual_auth: isDualAuth,
totp_enabled: !!user.totpEnabled, totp_enabled: !!user.totpEnabled,
data_unlocked: authManager.isUserUnlocked(userId),
}); });
} catch (err) { } catch (err) {
authLogger.error("Failed to get username", err); authLogger.error("Failed to get username", err);
-3
View File
@@ -188,7 +188,6 @@ export interface AuthResponse {
userId?: string; userId?: string;
is_oidc?: boolean; is_oidc?: boolean;
totp_enabled?: boolean; totp_enabled?: boolean;
data_unlocked?: boolean;
requires_totp?: boolean; requires_totp?: boolean;
temp_token?: string; temp_token?: string;
rememberMe?: boolean; rememberMe?: boolean;
@@ -201,7 +200,6 @@ export interface UserInfo {
username: string; username: string;
is_admin: boolean; is_admin: boolean;
is_oidc: boolean; is_oidc: boolean;
data_unlocked: boolean;
password_hash?: string; password_hash?: string;
} }
@@ -1716,7 +1714,6 @@ export async function loginUser(
rememberMe: response.data.rememberMe, rememberMe: response.data.rememberMe,
is_oidc: response.data.is_oidc, is_oidc: response.data.is_oidc,
totp_enabled: response.data.totp_enabled, totp_enabled: response.data.totp_enabled,
data_unlocked: response.data.data_unlocked,
token: response.data.token, token: response.data.token,
}; };
} catch (error) { } catch (error) {