From 2ebe741cb7550273601037be8d4fb7bf79e0d4c4 Mon Sep 17 00:00:00 2001 From: RedDucks Date: Mon, 5 Mar 2018 13:49:50 -0500 Subject: [PATCH] t --- db.js | 3 +-- routes/account/index.js | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/db.js b/db.js index 6cd6bc1..79d57b6 100644 --- a/db.js +++ b/db.js @@ -9,8 +9,7 @@ const auth = config.mongo.authentication let connection_string = ''; if(config.mongo.use_authentication) { - connection_string = `mongodb://${auth.username}:${auth.password}@${hostname}:${port}/\ - ${database}?authSource=${auth.authentication_database}` + connection_string = `mongodb://${auth.username}:${auth.password}@${hostname}:${port}/${database}?authSource=${auth.authentication_database}` }else { connection_string = `mongodb://${hostname}:${port}/${database}` } diff --git a/routes/account/index.js b/routes/account/index.js index 0aedca2..9cc4cf0 100644 --- a/routes/account/index.js +++ b/routes/account/index.js @@ -12,21 +12,31 @@ route_debugger.success('Loading \'account\' API routes'); routes.get('/email-confirmation', async (request, response) => { let _GET = request.query; + console.log(_GET) + if (!_GET.token) { return response.send('ERROR: Invalid token'); } + console.log(2) + let user = await database.user_collection.findOne({ 'sensitive.email_confirms.token': _GET.token }); + console.log(3) + if (!user) { return response.send('ERROR: Invalid token'); } + console.log(4) + user.email.reachable = 'Y'; user.email.validated = 'Y'; + console.log(5) + await database.user_collection.update({ pid: user.pid }, { @@ -35,9 +45,13 @@ routes.get('/email-confirmation', async (request, response) => { } }); + console.log(6) + user.sensitive.email_confirms.token = null; user.sensitive.email_confirms.code = null; + console.log(7) + await database.user_collection.update({ pid: user.pid }, { @@ -46,10 +60,11 @@ routes.get('/email-confirmation', async (request, response) => { } }); - response.send(``` - It has been confirmed that you can receive e-mails from Pretenod.
- The confirmation process is now complete. - ```); + console.log(8) + + response.send('It has been confirmed that you can receive e-mails from Pretenod. The confirmation process is now complete.'); + + console.log(9) }); module.exports = routes; \ No newline at end of file