Skip to content

Commit

Permalink
web: fix root password handling
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed May 13, 2024
1 parent d2096d1 commit 6cc5a78
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 6cc5a78

Please sign in to comment.