diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-04-19 22:29:36 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-04-19 22:29:36 +0200 |
commit | bb1e6d0ce32a6553a83e0a7863cb2b3a65023cd1 (patch) | |
tree | 69c580573f8c6ea615dda433bac79d169d3522de | |
parent | e7ea0979f896795a6fec8b64102313a40c4726f2 (diff) | |
download | PeerTube-bb1e6d0ce32a6553a83e0a7863cb2b3a65023cd1.tar.gz PeerTube-bb1e6d0ce32a6553a83e0a7863cb2b3a65023cd1.tar.zst PeerTube-bb1e6d0ce32a6553a83e0a7863cb2b3a65023cd1.zip |
Generate passwords at initialization (client/admin passwords)
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | server/initializers/installer.js | 9 |
2 files changed, 5 insertions, 5 deletions
diff --git a/package.json b/package.json index 242e1beb2..42acf1b90 100644 --- a/package.json +++ b/package.json | |||
@@ -58,6 +58,7 @@ | |||
58 | "multer": "^1.1.0", | 58 | "multer": "^1.1.0", |
59 | "node-ipc": "^7.0.0", | 59 | "node-ipc": "^7.0.0", |
60 | "openssl-wrapper": "^0.2.3", | 60 | "openssl-wrapper": "^0.2.3", |
61 | "password-generator": "^2.0.2", | ||
61 | "request": "^2.57.0", | 62 | "request": "^2.57.0", |
62 | "request-replay": "^1.0.2", | 63 | "request-replay": "^1.0.2", |
63 | "segfault-handler": "^1.0.0", | 64 | "segfault-handler": "^1.0.0", |
diff --git a/server/initializers/installer.js b/server/initializers/installer.js index ec9175f34..c2f5e47bc 100644 --- a/server/initializers/installer.js +++ b/server/initializers/installer.js | |||
@@ -3,6 +3,7 @@ | |||
3 | const async = require('async') | 3 | const async = require('async') |
4 | const config = require('config') | 4 | const config = require('config') |
5 | const mkdirp = require('mkdirp') | 5 | const mkdirp = require('mkdirp') |
6 | const passwordGenerator = require('password-generator') | ||
6 | const path = require('path') | 7 | const path = require('path') |
7 | 8 | ||
8 | const checker = require('./checker') | 9 | const checker = require('./checker') |
@@ -56,8 +57,7 @@ function createOAuthClientIfNotExist (callback) { | |||
56 | 57 | ||
57 | logger.info('Creating a default OAuth Client.') | 58 | logger.info('Creating a default OAuth Client.') |
58 | 59 | ||
59 | // TODO: generate password | 60 | const secret = passwordGenerator(32, false) |
60 | const secret = 'megustalabanana' | ||
61 | Users.createClient(secret, [ 'password' ], function (err, id) { | 61 | Users.createClient(secret, [ 'password' ], function (err, id) { |
62 | if (err) return callback(err) | 62 | if (err) return callback(err) |
63 | 63 | ||
@@ -78,9 +78,8 @@ function createOAuthUserIfNotExist (callback) { | |||
78 | 78 | ||
79 | logger.info('Creating the administrator.') | 79 | logger.info('Creating the administrator.') |
80 | 80 | ||
81 | // TODO: generate password | 81 | const username = 'root' |
82 | const username = 'admin' | 82 | const password = passwordGenerator(8, true) |
83 | const password = 'nomegustalabanana' | ||
84 | 83 | ||
85 | Users.createUser(username, password, function (err) { | 84 | Users.createUser(username, password, function (err) { |
86 | if (err) return callback(err) | 85 | if (err) return callback(err) |