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.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/initializers/installer.js b/server/initializers/installer.js
index 32830d4da..c12187871 100644
--- a/server/initializers/installer.js
+++ b/server/initializers/installer.js
@@ -9,6 +9,7 @@ const path = require('path')
9const series = require('async/series') 9const series = require('async/series')
10 10
11const checker = require('./checker') 11const checker = require('./checker')
12const constants = require('./constants')
12const logger = require('../helpers/logger') 13const logger = require('../helpers/logger')
13const peertubeCrypto = require('../helpers/peertube-crypto') 14const peertubeCrypto = require('../helpers/peertube-crypto')
14 15
@@ -34,7 +35,7 @@ function installApplication (callback) {
34 }, 35 },
35 36
36 function createOAuthUser (callbackAsync) { 37 function createOAuthUser (callbackAsync) {
37 createOAuthUserIfNotExist(callbackAsync) 38 createOAuthAdminIfNotExist(callbackAsync)
38 } 39 }
39 ], callback) 40 ], callback)
40} 41}
@@ -80,7 +81,7 @@ function createOAuthClientIfNotExist (callback) {
80 }) 81 })
81} 82}
82 83
83function createOAuthUserIfNotExist (callback) { 84function createOAuthAdminIfNotExist (callback) {
84 checker.usersExist(function (err, exist) { 85 checker.usersExist(function (err, exist) {
85 if (err) return callback(err) 86 if (err) return callback(err)
86 87
@@ -90,6 +91,7 @@ function createOAuthUserIfNotExist (callback) {
90 logger.info('Creating the administrator.') 91 logger.info('Creating the administrator.')
91 92
92 const username = 'root' 93 const username = 'root'
94 const role = constants.USER_ROLES.ADMIN
93 let password = '' 95 let password = ''
94 96
95 // Do not generate a random password for tests 97 // Do not generate a random password for tests
@@ -105,7 +107,8 @@ function createOAuthUserIfNotExist (callback) {
105 107
106 const user = new User({ 108 const user = new User({
107 username: username, 109 username: username,
108 password: password 110 password: password,
111 role: role
109 }) 112 })
110 113
111 user.save(function (err, createdUser) { 114 user.save(function (err, createdUser) {