mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-07-31 00:26:11 -05:00
t
This commit is contained in:
parent
49a3f4e62e
commit
2ebe741cb7
3
db.js
3
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}`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.<br>
|
||||
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;
|
||||
Loading…
Reference in New Issue
Block a user