mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-17 05:43:36 +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);
|
||||
|
||||
Reference in New Issue
Block a user