@experium/nest-bruteforce-guard
Version:
Authorization protection from bruteforce
50 lines (40 loc) • 943 B
text/typescript
import { Column, Entity, Index, ObjectIdColumn } from 'typeorm';
import { ObjectID } from 'mongodb';
export class LoginAttempt {
id: ObjectID;
login: string;
ip: string;
// 1 year
date: Date;
loginFailure: boolean;
attemptBlocked: boolean;
userDisabled: boolean;
badPassword: boolean;
constructor(
login: string,
ip: string,
loginFailure: boolean = false,
attemptBlocked: boolean = false,
userDisabled: boolean = false,
badPassword: boolean = false,
) {
this.login = login;
this.ip = ip;
this.date = new Date();
this.loginFailure = loginFailure;
this.attemptBlocked = attemptBlocked;
this.userDisabled = userDisabled;
this.badPassword = badPassword;
}
}