Generate passwords at initialization (client/admin passwords)

This commit is contained in:
Chocobozzz 2016-04-19 22:29:36 +02:00
parent e7ea0979f8
commit bb1e6d0ce3
2 changed files with 5 additions and 5 deletions

View File

@ -58,6 +58,7 @@
"multer": "^1.1.0", "multer": "^1.1.0",
"node-ipc": "^7.0.0", "node-ipc": "^7.0.0",
"openssl-wrapper": "^0.2.3", "openssl-wrapper": "^0.2.3",
"password-generator": "^2.0.2",
"request": "^2.57.0", "request": "^2.57.0",
"request-replay": "^1.0.2", "request-replay": "^1.0.2",
"segfault-handler": "^1.0.0", "segfault-handler": "^1.0.0",

View File

@ -3,6 +3,7 @@
const async = require('async') const async = require('async')
const config = require('config') const config = require('config')
const mkdirp = require('mkdirp') const mkdirp = require('mkdirp')
const passwordGenerator = require('password-generator')
const path = require('path') const path = require('path')
const checker = require('./checker') const checker = require('./checker')
@ -56,8 +57,7 @@ function createOAuthClientIfNotExist (callback) {
logger.info('Creating a default OAuth Client.') logger.info('Creating a default OAuth Client.')
// TODO: generate password const secret = passwordGenerator(32, false)
const secret = 'megustalabanana'
Users.createClient(secret, [ 'password' ], function (err, id) { Users.createClient(secret, [ 'password' ], function (err, id) {
if (err) return callback(err) if (err) return callback(err)
@ -78,9 +78,8 @@ function createOAuthUserIfNotExist (callback) {
logger.info('Creating the administrator.') logger.info('Creating the administrator.')
// TODO: generate password const username = 'root'
const username = 'admin' const password = passwordGenerator(8, true)
const password = 'nomegustalabanana'
Users.createUser(username, password, function (err) { Users.createUser(username, password, function (err) {
if (err) return callback(err) if (err) return callback(err)