metatroncubeswdev c309581df0 Initial commit: Quorla social media manager
Dashboard (content library, publishing queue with approvals, inbox, team
management, AI runs), Meta connector, branded PDF reports, agent skills,
and Docker packaging (Dockerfile, docker-compose with Caddy HTTPS,
backup and path-relocation scripts).

Client data, live data and secrets are excluded via .gitignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:02:29 -04:00

24 lines
1.1 KiB
JavaScript

// Add or update a dashboard login from the command line (backup for when no admin can sign in).
// Normally admins add teammates in the dashboard: Settings → Team members.
// npm run add-user -- you@agency.com "Your Name" admin (generates a password)
// npm run add-user -- you@agency.com "Your Name" member MyPass123 (sets this password)
// Writes to data/dashboard/users.json (hashed). The plain password is shown once.
import crypto from "node:crypto";
import { upsertFromCli } from "../users.js";
const [email, name = "", role = "member", given] = process.argv.slice(2);
if (!email || !/^[^@\s]+@[^@\s]+$/.test(email) || !["admin", "member"].includes(role)) {
console.error('Usage: npm run add-user -- you@agency.com "Your Name" admin|member [password]');
process.exit(1);
}
const password = given || crypto.randomBytes(9).toString("base64url");
try {
upsertFromCli({ email, name, role, password });
} catch (e) {
console.error(e.message);
process.exit(1);
}
console.log(`Saved ${role} ${email}. Any open sessions for this login are signed out.`);
if (!given) console.log(`Password (shown once, share it privately): ${password}`);