Fix the issue about identity on playbook creation

This commit is contained in:
Raphael MESSNER 2015-06-07 08:29:04 +02:00
parent abe19ce636
commit d7b9cc1f35

View File

@ -39,9 +39,9 @@ function addPlaybook (req, res) {
vault_password: req.body.vault_password
})
if (req.body.credential && req.body.credential.length > 0) {
if (typeof req.body.identity == 'string' && req.body.identity.length > 0) {
try {
playbook.credential = mongoose.Types.ObjectId(req.body.credential)
playbook.identity = mongoose.Types.ObjectId(req.body.identity);
} catch (e) {}
}