fix some artifact serialization trouble; fix login error
This commit is contained in:
@@ -26,9 +26,10 @@ router.post('/', function(req, res) {
|
||||
//res.status(400).json({"error":"session.users"});
|
||||
})
|
||||
.then(user => {
|
||||
console.log("!!! user: ",user.password_hash);
|
||||
|
||||
if (bcrypt.compareSync(password, user.password_hash)) {
|
||||
if (!user) {
|
||||
res.sendStatus(404);
|
||||
}
|
||||
else if (bcrypt.compareSync(password, user.password_hash)) {
|
||||
crypto.randomBytes(48, function(ex, buf) {
|
||||
var token = buf.toString('hex');
|
||||
console.log("!!! token: ",token);
|
||||
|
||||
@@ -53,15 +53,8 @@ router.get('/', (req, res) => {
|
||||
space_id: req.space._id
|
||||
}}).then(artifacts => {
|
||||
async.map(artifacts, (a, cb) => {
|
||||
//a = a.toObject(); TODO
|
||||
db.unpackArtifact(a);
|
||||
|
||||
if (a.control_points) {
|
||||
a.control_points = JSON.parse(a.control_points);
|
||||
}
|
||||
if (a.payload_alternatives) {
|
||||
a.payload_alternatives = JSON.parse(a.payload_alternatives);
|
||||
}
|
||||
|
||||
if (a.user_id) {
|
||||
// FIXME JOIN
|
||||
/*User.findOne({where: {
|
||||
@@ -131,7 +124,8 @@ router.post('/:artifact_id/payload', function(req, res, next) {
|
||||
var stream = req.pipe(writeStream);
|
||||
|
||||
var progress_callback = function(progress_msg) {
|
||||
a.description = progress_msg;
|
||||
a.description = progress_msg.toString();
|
||||
db.packArtifact(a);
|
||||
a.save();
|
||||
redis.sendMessage("update", a, a.toJSON(), req.channelId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user