send/server/routes/password.js

18 lines
355 B
JavaScript
Raw Normal View History

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