Identification
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/arrow-clicked': 'index'
|
||||
'/posts/arrow-clicked': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/coin-clicked': 'index'
|
||||
'/posts/coin-clicked': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/coin-id': 'index'
|
||||
'/posts/coin-id': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/coin-info': 'index'
|
||||
'/posts/coin-info': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/fps': 'index'
|
||||
'/posts/fps': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/hovered': 'index'
|
||||
'/posts/hovered': 'index'
|
||||
};
|
||||
|
||||
27
posts/identification/index.js
Normal file
27
posts/identification/index.js
Normal 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('/');
|
||||
});
|
||||
|
||||
};
|
||||
3
posts/identification/urls.js
Normal file
3
posts/identification/urls.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/identification': 'index'
|
||||
};
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/keyboard-event': 'index'
|
||||
'/posts/keyboard-event': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/pointer-locked': 'index'
|
||||
'/posts/pointer-locked': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/previous-next-clicked': 'index'
|
||||
'/posts/previous-next-clicked': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/reset-clicked': 'index'
|
||||
'/posts/reset-clicked': 'index'
|
||||
};
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module.exports = {
|
||||
'/switched-lock-option': 'index'
|
||||
'/posts/switched-lock-option': 'index'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user