Database now stores hashes of recently used IP's for all users. They are retained for seven days AFTER their LAST use.
This commit is contained in:
parent
6b0a73e1c8
commit
6e785dc211
6 changed files with 112 additions and 12 deletions
|
|
@ -18,15 +18,22 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
const cron = require('node-cron');
|
||||
|
||||
//Local Imports
|
||||
const {userModel} = require('../schemas/userSchema');
|
||||
const userBanModel = require('../schemas/userBanSchema');
|
||||
const channelModel = require('../schemas/channel/channelSchema');
|
||||
|
||||
module.exports.schedule = function(){
|
||||
//Process hashed IP Records that haven't been recorded in a week or more
|
||||
cron.schedule('0 0 * * *', ()=>{userModel.processAgedIPRecords()},{scheduled: true, timezone: "UTC"});
|
||||
//Process expired global bans every night at midnight
|
||||
cron.schedule('0 0 * * *', ()=>{userBanModel.processExpiredBans()},{scheduled: true, timezone: "UTC"});
|
||||
//Process expired channel bans every night at midnight
|
||||
cron.schedule('0 0 * * *', ()=>{channelModel.processExpiredBans()},{scheduled: true, timezone: "UTC"});
|
||||
}
|
||||
|
||||
module.exports.kickoff = function(){
|
||||
//Process Hashed IP Records that haven't been recorded in a week or more
|
||||
userModel.processAgedIPRecords();
|
||||
//Process expired global bans that may have expired since last restart
|
||||
userBanModel.processExpiredBans()
|
||||
//Process expired channel bans that may haven ot expired since last restart
|
||||
|
|
|
|||
|
|
@ -48,9 +48,8 @@ module.exports.authenticateSession = async function(user, pass, req){
|
|||
rank: userDB.rank
|
||||
}
|
||||
|
||||
|
||||
//userDB.activeSessions.push(sessionData);
|
||||
await userDB.save();
|
||||
//Tattoo hashed IP address to user account for seven days
|
||||
userDB.tattooIPRecord(req.ip);
|
||||
|
||||
//return user
|
||||
return userDB.user;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue