@kiattiwong-jdea/jauthenlog
v1.0.0
Published
JCore Authentication Logger - Track and manage login attempts with database logging
Readme
JAuthenLog
Authentication Logger - Track and manage login attempts with database logging
Installation
npm install @kiattiwong-jdea/jauthenlogEnvironment Variables
AUTHENLOG_DB_HOST=localhost
AUTHENLOG_DB_PORT=3306
AUTHENLOG_DB_USERNAME=root
AUTHENLOG_DB_PASSWORD=password
AUTHENLOG_DB_NAME=your_databaseUsage
import { Authen, DBTYPE, ATTEMPT_UNIT_CONDITION } from '@kiattiwong-jdea/jauthenlog';
const authen = new Authen({
dbType: DBTYPE.MYSQL,
limitFailed: 5,
attemptAmount: 15,
attemptUnit: ATTEMPT_UNIT_CONDITION.MINUTE
});
// Validate login attempt
const result = await authen.ValidateAuthAttempt({
username: '[email protected]',
ipAddress: '192.168.1.1'
});
// Clear authentication log on successful login
await authen.ClearAuthenLog({
username: '[email protected]',
ipAddress: '192.168.1.1'
});License
MIT
