3d-interface/posts/identification/index.js

31 lines
854 B
JavaScript
Raw Normal View History

2015-07-23 17:19:53 +02:00
var pg = require('pg');
var secret = require('../../private');
var db = require('../../controllers/prototype/dbrequests.js');
var Log = require('../../lib/NodeLog.js');
module.exports.index = function(req, res) {
2015-07-27 16:59:53 +02:00
db.checkUserName(req.body.inputId, function(ok) {
if (!ok) {
2015-07-23 17:19:53 +02:00
2015-09-09 15:18:18 +02:00
db.createUser(
req.body.inputId,
req.body.inputAge,
req.body.inputGender === 'male',
req.body.input3dskills,
req.body.inputLastTime,
function(id) {
req.session.userId = id;
req.session.save();
res.redirect('/prototype/tutorial');
}
);
2015-07-23 17:19:53 +02:00
} else {
req.session.identificationFailed = true;
res.redirect('/user-study');
}
2015-07-23 17:19:53 +02:00
});
};