Skip to content

Commit 244c2d3

Browse files
authored
fix(backend): add login as deblocking event (#3866)
* fix(backend): add login as deblocking evevnt * fix(backend): adding requesting password reset to surveilled events
1 parent 5139ec3 commit 244c2d3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/backend/src/modules/users/services/userSecurityEventHistoryManager.service.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export function getBackoffTime(
5555
const lastEventType = eventsHistory[eventsHistory.length - 1].type;
5656

5757
if (
58+
lastEventType === "login-success" ||
5859
lastEventType === "change-password-success" ||
5960
lastEventType === "reset-password-success"
6061
) {
@@ -69,7 +70,18 @@ export function getBackoffTime(
6970
);
7071

7172
const eventHistoryMap = eventsRecentHistory.reduce((acc, event) => {
72-
acc[event.type] = (acc[event.type] || 0) + 1;
73+
if (
74+
[
75+
"reset-password-request",
76+
"reset-password-error",
77+
"login-error",
78+
"change-password-error",
79+
"validate-account-error",
80+
].includes(event.type)
81+
) {
82+
acc[event.type] = (acc[event.type] || 0) + 1;
83+
return acc;
84+
}
7385
return acc;
7486
}, {} as Record<string, number>);
7587

0 commit comments

Comments
 (0)