-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmongo-init.js
More file actions
31 lines (24 loc) · 896 Bytes
/
mongo-init.js
File metadata and controls
31 lines (24 loc) · 896 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
// Switch to your application database
db = db.getSiblingDB('UMOCWAnalysis');
const adminUser = {
email: "admin@ocw.um.local",
username: "Dr. Hadi",
password: "$2a$08$VTJiZ866KDdSffheJR8pV.X0QTL/KVx6QaLKzK1AxyaAaN7KM4DQe", // Hash for "123456"
role: "admin",
};
// Check if admin already exists
const existingAdmin = db.users.findOne({ email: adminUser.email });
if (!existingAdmin) {
db.users.insertOne(adminUser);
print('✅ Default admin user created successfully!');
print('');
print('===========================================');
print('📧 Email: admin@ocw.um.local');
print('👤 Username: admin');
print('🔑 Password: 123456');
print('===========================================');
print('');
print('⚠️ IMPORTANT: Change the default password after first login!');
} else {
print('ℹ️ Admin user already exists. Skipping creation.');
}