mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-10 19:31:39 +00:00
log failed auth attempts
This commit is contained in:
parent
f9f89e1e51
commit
55ebc32360
1 changed files with 10 additions and 3 deletions
|
|
@ -3,7 +3,8 @@
|
|||
*/
|
||||
const passport = require('passport-strategy')
|
||||
const util = require('util')
|
||||
|
||||
const Logger = require('../../Logger')
|
||||
const requestIp = require('../../libs/requestIp')
|
||||
|
||||
function lookup(obj, field) {
|
||||
if (!obj) { return null; }
|
||||
|
|
@ -96,8 +97,14 @@ Strategy.prototype.authenticate = function (req, options) {
|
|||
var self = this;
|
||||
|
||||
function verified(err, user, info) {
|
||||
if (err) { return self.error(err); }
|
||||
if (!user) { return self.fail(info); }
|
||||
if (err) {
|
||||
return self.error(err);
|
||||
}
|
||||
if (!user) {
|
||||
const clientIp = requestIp.getClientIp(req);
|
||||
Logger.error(`[Auth] User:(${username}) attempted login FAILED from IP:(${clientIp})`);
|
||||
return self.fail(info);
|
||||
}
|
||||
self.success(user, info);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue