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