Identification

This commit is contained in:
Thomas FORGIONE
2015-07-23 17:19:53 +02:00
parent 9fba3faaf6
commit eb79b0bc42
22 changed files with 166 additions and 99 deletions

View File

@@ -1,3 +1,3 @@
module.exports = {
'/arrow-clicked': 'index'
'/posts/arrow-clicked': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/coin-clicked': 'index'
'/posts/coin-clicked': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/coin-id': 'index'
'/posts/coin-id': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/coin-info': 'index'
'/posts/coin-info': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/fps': 'index'
'/posts/fps': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/hovered': 'index'
'/posts/hovered': 'index'
};

View File

@@ -0,0 +1,27 @@
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) {
db.tryUser(req.session.user_id, function(id) {
req.session.user_id = id;
req.session.save();
pg.connect(secret.url, function(err, client, release) {
client.query(
"UPDATE Users SET worker_id = $1, age = $2, male = $3 WHERE id = $4;",
[req.body.inputId, req.body.inputAge, req.body.inputGender === 'male', req.session.user_id],
function(err, result) {
if (err !== null)
Log.dberror(err + ' in identfication');
release();
}
);
});
res.redirect('/');
});
};

View File

@@ -0,0 +1,3 @@
module.exports = {
'/identification': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/keyboard-event': 'index'
'/posts/keyboard-event': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/pointer-locked': 'index'
'/posts/pointer-locked': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/previous-next-clicked': 'index'
'/posts/previous-next-clicked': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/reset-clicked': 'index'
'/posts/reset-clicked': 'index'
};

View File

@@ -1,3 +1,3 @@
module.exports = {
'/switched-lock-option': 'index'
'/posts/switched-lock-option': 'index'
};