Some cleaning 😢
This commit is contained in:
39
server/controllers/vcode/index.js
Normal file
39
server/controllers/vcode/index.js
Normal file
@@ -0,0 +1,39 @@
|
||||
var db = require('../prototype/dbrequests.js');
|
||||
var vcode = require('../../lib/vcode.js');
|
||||
|
||||
module.exports.index = function(req, res) {
|
||||
|
||||
// If not micro-worker
|
||||
if (req.session.workerId === undefined) {
|
||||
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
res.send(null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Else, check that exp was correctly done
|
||||
db.getUser(req.session.userId, function(workerId, ok) {
|
||||
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
if (ok === true) {
|
||||
|
||||
var code = vcode(req.session.workerId);
|
||||
res.send(code);
|
||||
|
||||
} else if (ok === false) {
|
||||
|
||||
res.send('no vcode');
|
||||
|
||||
} else {
|
||||
|
||||
res.send('not ready');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
3
server/controllers/vcode/urls.js
Normal file
3
server/controllers/vcode/urls.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/vcode': 'index',
|
||||
};
|
||||
Reference in New Issue
Block a user