Finished up with email change backend. Just need to make a prompt on the profile page for our AJAX call.
This commit is contained in:
parent
4a865e8aa8
commit
a51152a89d
14 changed files with 444 additions and 13 deletions
|
|
@ -16,8 +16,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
|
||||
//At some point this will be a bit more advanced, right now it's just a placeholder :P
|
||||
module.exports.errorHandler = function(res, msg, type = "Generic", status = 400){
|
||||
res.status(status);
|
||||
return res.send({errors: [{type, msg, date: new Date()}]});
|
||||
//Some controllers do things after sending headers, for those, we should remain silent
|
||||
if(!res.headersSent){
|
||||
res.status(status);
|
||||
return res.send({errors: [{type, msg, date: new Date()}]});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.exceptionHandler = function(res, err){
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ const cron = require('node-cron');
|
|||
const {userModel} = require('../schemas/user/userSchema');
|
||||
const userBanModel = require('../schemas/user/userBanSchema');
|
||||
const passwordResetModel = require('../schemas/user/passwordResetSchema');
|
||||
const emailChangeModel = require('../schemas/user/emailChangeSchema');
|
||||
const channelModel = require('../schemas/channel/channelSchema');
|
||||
const sessionUtils = require('./sessionUtils');
|
||||
const { email } = require('../validators/accountValidator');
|
||||
|
||||
module.exports.schedule = function(){
|
||||
//Process hashed IP Records that haven't been recorded in a week or more
|
||||
|
|
@ -35,6 +37,8 @@ module.exports.schedule = function(){
|
|||
cron.schedule('0 0 * * *', ()=>{sessionUtils.processExpiredAttempts()},{scheduled: true, timezone: "UTC"});
|
||||
//Process expired password reset requests every night at midnight
|
||||
cron.schedule('0 0 * * *', ()=>{passwordResetModel.processExpiredRequests()},{scheduled: true, timezone: "UTC"});
|
||||
//Process expired email change requests every night at midnight
|
||||
cron.schedule('0 0 * * *', ()=>{emailChangeModel.processExpiredRequests()},{scheduled: true, timezone: "UTC"});
|
||||
}
|
||||
|
||||
module.exports.kickoff = function(){
|
||||
|
|
@ -46,7 +50,8 @@ module.exports.kickoff = function(){
|
|||
channelModel.processExpiredBans();
|
||||
//Process expired password reset requests that may have expired since last restart
|
||||
passwordResetModel.processExpiredRequests();
|
||||
|
||||
//Process expired email change requests that may have expired since last restart
|
||||
emailChangeModel.processExpiredRequests();
|
||||
|
||||
//Schedule jobs
|
||||
module.exports.schedule();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue