mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
Log IP address on failed login attempts
This commit is contained in:
parent
70a9ba4efb
commit
bfbe059505
1 changed files with 3 additions and 0 deletions
|
|
@ -16,8 +16,10 @@ import {
|
||||||
import { getUserByUsername } from 'queries';
|
import { getUserByUsername } from 'queries';
|
||||||
import * as yup from 'yup';
|
import * as yup from 'yup';
|
||||||
import { ROLES } from 'lib/constants';
|
import { ROLES } from 'lib/constants';
|
||||||
|
import { getIpAddress } from 'lib/detect';
|
||||||
|
|
||||||
const log = debug('umami:auth');
|
const log = debug('umami:auth');
|
||||||
|
const logFailed = debug('umami:auth:failed');
|
||||||
|
|
||||||
export interface LoginRequestBody {
|
export interface LoginRequestBody {
|
||||||
username: string;
|
username: string;
|
||||||
|
|
@ -68,6 +70,7 @@ export default async (
|
||||||
}
|
}
|
||||||
|
|
||||||
log('Login failed:', { username, user });
|
log('Login failed:', { username, user });
|
||||||
|
logFailed(`Login from ip ${getIpAddress(req)} failed.`);
|
||||||
|
|
||||||
return unauthorized(res, 'message.incorrect-username-password');
|
return unauthorized(res, 'message.incorrect-username-password');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue