mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Exit signal handling polish, login page info added
This commit is contained in:
parent
4f030ad27c
commit
88d487568c
6 changed files with 21 additions and 69 deletions
|
@ -46,8 +46,8 @@ const dailyDataCountFile = 'stats/dailyDataCount'
|
|||
const usersDbBackupPath = 'data/dbs/backup'
|
||||
|
||||
const maxVeteranPwGetCount = 10
|
||||
const addPWPerDay = 3 // every x day a user can give a pw
|
||||
const maxPWCount = 2 // maximum pw give opportunities a user can have at once
|
||||
const addPWPerDay = 1 // every x day a user can give a pw
|
||||
const maxPWCount = 4 // maximum pw give opportunities a user can have at once
|
||||
const daysAfterUserGetsPWs = 2 // days after user gets pw-s
|
||||
|
||||
let userDB
|
||||
|
@ -229,6 +229,7 @@ function GetApp () {
|
|||
app.post('/login', (req, res) => {
|
||||
logger.LogReq(req)
|
||||
const pw = req.body.pw || false
|
||||
const cid = req.body.cid
|
||||
const isScript = req.body.script
|
||||
const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
|
||||
const user = dbtools.Select(userDB, 'users', {
|
||||
|
@ -286,7 +287,7 @@ function GetApp () {
|
|||
})
|
||||
logger.Log(`Successfull login to ${isScript ? 'script' : 'website'} with user ID: #${user.id}`, logger.GetColor('cyan'))
|
||||
} else {
|
||||
logger.Log(`Login attempt with invalid pw: ${pw} to ${isScript ? 'script' : 'website'}`, logger.GetColor('cyan'))
|
||||
logger.Log(`Login attempt with invalid pw: ${pw} to ${isScript ? 'script' : 'website'}${cid ? ', CID:' + cid : ''}`, logger.GetColor('cyan'))
|
||||
res.json({
|
||||
result: 'error',
|
||||
msg: 'Invalid password'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue