jcoppieters / cody

Javascript Content Management System running on Node.js
howest.cody-cms.org
MIT License
678 stars 197 forks source link

When the user password is empty, this can lead to wrong password #29

Closed linksgo2011 closed 9 years ago

linksgo2011 commented 9 years ago

In the Application.js file

this.dbuser = config.dbuser || "cody"; this.dbpassword = config.dbpassword || "ydoc"; // When the user password is empty, this can lead to wrong password this.dbhost = config.dbhost || "localhost"; this.db = config.db || "cody"; this.smtp = config.smtp || "smtp.telenet.be"; this.smtpoptions = config.smtpoptions; // see https://github.com/andris9/Nodemailer this.mailFrom = config.mailFrom || "info@cody-cms.org";

jcoppieters commented 9 years ago

ok like this? this.dbpassword = (config.dbpassword==="") ? "" : config.dbpassword || "ydoc";

someone has better idea's ?

Johan.

jcoppieters commented 9 years ago

But it probably is wrong too in (our template startup script in doc/empty/index.js)

// 2. if -c exists, overwrite customized config values if(process.argv.indexOf("-c") != -1){ var extraConfigFilePath = process.argv[process.argv.indexOf("-c") + 1]; var obj = JSON.parse(fs.readFileSync(extraConfigFilePath, 'utf8')); Object.keys(cody.config).forEach(function (name) { cody.config[name] = obj[name] || cody.config[name]; }); }

// 3. overwrite environment variable values Object.keys(cody.config).forEach(function (name) { cody.config[name] = process.env[name] || cody.config[name]; });

ticup commented 9 years ago

I guess we should use

this.dbpassword = (typeof config.dbpassword === "undefined") ? "ydoc" : config.dbpassword;

and

cody.config[name] = (typeof obj[name] === "undefined") ? cody.config[name] : obj[name];

?

jcoppieters commented 9 years ago

commit on github and new npm version