-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstalladmin.js
More file actions
41 lines (29 loc) · 932 Bytes
/
installadmin.js
File metadata and controls
41 lines (29 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// install public keys in the key table
//const openpgp = require('openpgp');
const db = require('./src/utils/db');
//const fs = require('fs');
//const PubKeyController = require('./src/controllers/PubKeyController');
const adminModel = require('./src/models/Admin');
const passport = require("passport");
passport.use(adminModel.createStrategy());
passport.serializeUser(adminModel.serializeUser());
passport.deserializeUser(adminModel.deserializeUser());
const adminUsername = 'admin';
const adminPassword = 'login';
const adminEmail = 'bob@schluss.org';
// run the process
module.exports.run = async function(){
await db.connect();
admin = new adminModel({
username : adminUsername,
email : adminEmail
});
adminModel.register(admin, adminPassword, function(err) {
if (err) {
console.log(err);
throw('error while user admin!', err);
}
console.log('admin registered!');
});
return true;
}