Skip to content

Commit

Permalink
Fix root password detection (#1201)
Browse files Browse the repository at this point in the history
Properly detect whether the root password is set.
  • Loading branch information
imobachgs authored May 13, 2024
2 parents d2096d1 + 6cc5a78 commit 4be7618
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/src/client/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class UsersBaseClient {
return false;
}
const config = await response.json();
return config.password !== "";
return config.password;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions web/src/client/users.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 4be7618

Please sign in to comment.