aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/installer.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/installer.js')
-rw-r--r--server/initializers/installer.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/initializers/installer.js b/server/initializers/installer.js
index d5382364e..fb63b81ac 100644
--- a/server/initializers/installer.js
+++ b/server/initializers/installer.js
@@ -96,6 +96,7 @@ function createOAuthAdminIfNotExist (callback) {
96 96
97 const username = 'root' 97 const username = 'root'
98 const role = constants.USER_ROLES.ADMIN 98 const role = constants.USER_ROLES.ADMIN
99 const createOptions = {}
99 let password = '' 100 let password = ''
100 101
101 // Do not generate a random password for tests 102 // Do not generate a random password for tests
@@ -105,17 +106,20 @@ function createOAuthAdminIfNotExist (callback) {
105 if (process.env.NODE_APP_INSTANCE) { 106 if (process.env.NODE_APP_INSTANCE) {
106 password += process.env.NODE_APP_INSTANCE 107 password += process.env.NODE_APP_INSTANCE
107 } 108 }
109
110 // Our password is weak so do not validate it
111 createOptions.validate = false
108 } else { 112 } else {
109 password = passwordGenerator(8, true) 113 password = passwordGenerator(8, true)
110 } 114 }
111 115
112 const user = db.User.build({ 116 const userData = {
113 username, 117 username,
114 password, 118 password,
115 role 119 role
116 }) 120 }
117 121
118 user.save().asCallback(function (err, createdUser) { 122 db.User.create(userData, createOptions).asCallback(function (err, createdUser) {
119 if (err) return callback(err) 123 if (err) return callback(err)
120 124
121 logger.info('Username: ' + username) 125 logger.info('Username: ' + username)