mirror of
https://github.com/plankanban/planka.git
synced 2025-07-21 14:19:44 +02:00
feat: Modify logger to log to file that supports fail2ban (#284)
This commit is contained in:
parent
21ef850913
commit
6429e22d59
12 changed files with 427 additions and 7844 deletions
|
@ -1,6 +1,8 @@
|
|||
const bcrypt = require('bcrypt');
|
||||
const validator = require('validator');
|
||||
|
||||
const { getRemoteAddress } = require('../../../utils/remoteAddress');
|
||||
|
||||
const Errors = {
|
||||
INVALID_EMAIL_OR_USERNAME: {
|
||||
invalidEmailOrUsername: 'Invalid email or username',
|
||||
|
@ -41,10 +43,16 @@ module.exports = {
|
|||
const user = await sails.helpers.users.getOneByEmailOrUsername(inputs.emailOrUsername);
|
||||
|
||||
if (!user) {
|
||||
sails.log.warn(
|
||||
`Invalid email or username: "${inputs.emailOrUsername}"! (IP: ${getRemoteAddress(
|
||||
this.req,
|
||||
)})`,
|
||||
);
|
||||
throw Errors.INVALID_EMAIL_OR_USERNAME;
|
||||
}
|
||||
|
||||
if (!bcrypt.compareSync(inputs.password, user.password)) {
|
||||
sails.log.warn(`Invalid password! (IP: ${getRemoteAddress(this.req)})`);
|
||||
throw Errors.INVALID_PASSWORD;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue