Skip to content

Commit d38cd2b

Browse files
committed
fix: set passwordLoginEnabled in the unit test; refresh status doc comment
PasswordlessAuthServiceTest uses @Injectmocks, and Mockito does not process @value — every such field is set by hand with ReflectionTestUtils. The new passwordLoginEnabled boolean was not, so it defaulted to false and both loginWithPassword tests hit the new rejection branch and failed. Worth spelling out because the polarity is the trap: rateLimitEnabled is also unset in this test and that is harmless, because it is read as `if (rateLimitEnabled)` — absence just skips the feature. Password login is read as `if (!passwordLoginEnabled)`, so absence blocks every login instead. Also refreshes the getStatus() doc comment in client.js, which still listed only the four original fields. Verified: PasswordlessAuthServiceTest 2/2, SetupControllerTest 6/6, no failures, errors or skips.
1 parent 24f085e commit d38cd2b

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

backend/src/test/java/com/dbaagent/service/PasswordlessAuthServiceTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ void setUp() {
5757
ReflectionTestUtils.setField(service, "maxIpStarts", 20);
5858
ReflectionTestUtils.setField(service, "maxPasswordFailures", 10);
5959
ReflectionTestUtils.setField(service, "adminMfaEnabled", false);
60+
// @Value is not processed by @InjectMocks, so a boolean field defaults to
61+
// false. Unlike rateLimitEnabled (checked as `if (enabled)`, so absence
62+
// merely skips it), password login is checked as `if (!enabled)` — leaving
63+
// it unset would reject every login below.
64+
ReflectionTestUtils.setField(service, "passwordLoginEnabled", true);
6065

6166
when(authLoginChallengeRepository.save(any(AuthLoginChallenge.class)))
6267
.thenAnswer(invocation -> invocation.getArgument(0));

src/lib/api/client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3682,7 +3682,8 @@ export const setupAPI = {
36823682

36833683
/**
36843684
* Returns current setup state: setupComplete, hasOrganizationInfo,
3685-
* hasConnections, hasLlmConfig. Public endpoint — no auth required.
3685+
* hasConnections, hasLlmConfig, googleEnabled, passwordLoginEnabled.
3686+
* Public endpoint — no auth required.
36863687
*/
36873688
getStatus: async () => {
36883689
const response = await apiClient.get("/api/setup/status");

0 commit comments

Comments
 (0)