2017-08-31 18:43:36 +02:00
|
|
|
const storage = require('../storage');
|
|
|
|
|
2018-02-06 23:31:18 +01:00
|
|
|
module.exports = function(req, res) {
|
2017-08-31 18:43:36 +02:00
|
|
|
const id = req.params.id;
|
2018-01-24 19:23:13 +01:00
|
|
|
const auth = req.body.auth;
|
|
|
|
if (!auth) {
|
2017-08-31 18:43:36 +02:00
|
|
|
return res.sendStatus(400);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2018-01-24 19:23:13 +01:00
|
|
|
storage.setField(id, 'auth', auth);
|
2018-02-06 23:31:18 +01:00
|
|
|
storage.setField(id, 'pwd', true);
|
2018-01-24 19:23:13 +01:00
|
|
|
res.sendStatus(200);
|
2017-08-31 18:43:36 +02:00
|
|
|
} catch (e) {
|
2017-12-08 18:45:00 +01:00
|
|
|
return res.sendStatus(404);
|
2017-08-31 18:43:36 +02:00
|
|
|
}
|
|
|
|
};
|