Download scripts/createAdmin.js from Frenchbane/ok-id-pro: direct link, hf CLI and curl.
- Browser
- Download file 798 Bytes
-
https://huggingface.co/datasets/Frenchbane/ok-id-pro/resolve/main/scripts/createAdmin.js
- Command line
-
hf download hf://datasets/Frenchbane/ok-id-pro/scripts/createAdmin.js
-
curl -L -o createAdmin.js https://huggingface.co/datasets/Frenchbane/ok-id-pro/resolve/main/scripts/createAdmin.js
798 Bytes
| const mongoose = require('mongoose'); | |
| const argon2 = require('argon2'); | |
| require('dotenv').config(); | |
| const UserSchema = new mongoose.Schema({ | |
| username: String, email: String, password: String, role: String, | |
| activation: { isActive: Boolean, plan: String, renderQuota: Number } | |
| }); | |
| const User = mongoose.model('User', UserSchema); | |
| async function createAdmin() { | |
| await mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/okid_db'); | |
| const admin = new User({ | |
| username: 'admin', | |
| email: 'admin@example.com', | |
| password: await argon2.hash('Admin123!'), | |
| role: 'admin', | |
| activation: { isActive: true, plan: 'unlimited', renderQuota: 999999 } | |
| }); | |
| await admin.save(); | |
| console.log('Admin user created'); | |
| process.exit(0); | |
| } | |
| createAdmin().catch(console.error); |