Skip to content

Commit e97cfa7

Browse files
committed
Increment failed login attempts only if username or password is wrong
1 parent 2dcb06f commit e97cfa7

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

main.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,22 +333,22 @@ class SofarCloud extends utils.Adapter {
333333
return data.data.accessToken;
334334
}
335335

336-
await this.incrementFailedLoginAttempts();
337-
338336
const code = response.data.code;
339337

340-
this.log.error(
341-
`Login failed: ${data.message} (Attempt ${this.failedLoginAttempts}/${this.MAX_LOGIN_ATTEMPTS}. Code: ${code})`,
342-
);
343-
344338
if (code === "101021") {
345339
this.log.error("Wrong username");
340+
await this.incrementFailedLoginAttempts();
346341
}
347342

348343
if (code === "666666") {
349344
this.log.error("Wrong password");
345+
await this.incrementFailedLoginAttempts();
350346
}
351347

348+
this.log.error(
349+
`Login failed: ${data.message} (Attempt ${this.failedLoginAttempts}/${this.MAX_LOGIN_ATTEMPTS}. Code: ${code})`,
350+
);
351+
352352
if (this.failedLoginAttempts >= this.MAX_LOGIN_ATTEMPTS) {
353353
this.log.warn(
354354
"Maximum login attempts reached – adapter paused until configuration is corrected.",

0 commit comments

Comments
 (0)