From 6cc5a78f39f5cbf301d3deebeed526a26c9358c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Mon, 13 May 2024 13:10:37 +0100 Subject: [PATCH] web: fix root password handling --- web/src/client/users.js | 2 +- web/src/client/users.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/client/users.js b/web/src/client/users.js index 9689a2069d..a62663ba7f 100644 --- a/web/src/client/users.js +++ b/web/src/client/users.js @@ -84,7 +84,7 @@ class UsersBaseClient { return false; } const config = await response.json(); - return config.password !== ""; + return config.password; } /** diff --git a/web/src/client/users.test.js b/web/src/client/users.test.js index fbecae44b9..31929d351e 100644 --- a/web/src/client/users.test.js +++ b/web/src/client/users.test.js @@ -79,7 +79,7 @@ describe("#getUser", () => { describe("#isRootPasswordSet", () => { describe("when the root password is set", () => { beforeEach(() => { - mockJsonFn.mockResolvedValue({ password: "12345", sshkey: "" }); + mockJsonFn.mockResolvedValue({ password: true, sshkey: "" }); }); it("returns true", async () => { @@ -90,7 +90,7 @@ describe("#isRootPasswordSet", () => { describe("when the root password is not set", () => { beforeEach(() => { - mockJsonFn.mockResolvedValue({ password: "", sshkey: "" }); + mockJsonFn.mockResolvedValue({ password: false, sshkey: "" }); }); it("returns false", async () => {