diff options
Diffstat (limited to 'lib/validate.js')
-rw-r--r-- | lib/validate.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/validate.js b/lib/validate.js new file mode 100644 index 0000000..1480b11 --- /dev/null +++ b/lib/validate.js @@ -0,0 +1,31 @@ +/* + * mongo-edu + * + * Copyright (c) 2014 Przemyslaw Pluta + * Licensed under the MIT license. + * https://github.com/przemyslawpluta/mongo-edu/blob/master/LICENSE + */ + +var mkdirp = require('mkdirp'); + +module.exports.init = function init(opt, callback) { + + var profile = [ + { type: 'input', name: 'user', message: 'MongoDB Uni User Name', default: '', validate: function(value) { + if (value !== '') { return true; } + return "Please enter your MongoDB Uni user name - email address"; + }}, + { type: 'password', message: 'MongoDB Uni Password', name: 'password', validate: function(value) { + if (value !== '') { return true; } + return "Please enter your MongoDB Uni password"; + }} + ]; + + if (opt.u !== '') { profile[0].default = opt.u; } + + mkdirp(opt.d, function mkdirp(err) { + if (err !== null) { return callback(err); } + callback(null, profile); + }); + +}; |