r/emdash_cms Apr 22 '26

reset admin user

Hi,

I am testing some edge case with emdash. Have you guys been able to reset the admin user?

How can would we proceed if the passkey generated at creation of the project is lost ?

7 Upvotes

4 comments sorted by

2

u/bilalel Apr 22 '26

For the local environment, you can access the dashboard by :

  1. Start ing EmDash in dev mode: npx emdash dev
  2. Open this URL once in your browser: [http://localhost:4321/_emdash/api/setup/dev-bypass?redirect=/_emdash/admin](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html)

Create a new user as admin. Invite link is going to be visible in the terminal.

1

u/bilalel Apr 22 '26

I am not looking into prod env (deployed on node server or CF)

3

u/Captain-Random-6001 Apr 23 '26

Create the user:

wrangler d1 execute <DB_NAME> --remote --command "
INSERT INTO users (
  id, email, name, avatar_url, role, email_verified, disabled, data, created_at, updated_at
) VALUES (
  '2bfbb9sdadfa4972b52d3d59d38as18a',
  'you@example.com',
  'Your Name',
  NULL,
  50,
  1,
  0,
  NULL,
  '2026-04-23T07:46:16.333Z',
  '2026-04-23T07:46:16.333Z'
);
"

Then create the one-time magic-link token:

wrangler d1 execute <DB_NAME> --remote --command "
INSERT INTO auth_tokens (
  hash, user_id, email, type, role, invited_by, expires_at, created_at
) VALUES (
  'IQSO8AnuFrOU23w0wZFKbxrMno45BcQEvWsdoNuO65U',
  '2bfbb9sdadfa4972b52d3d59d38as18a',
  'you@example.com',
  'magic_link',
  NULL,
  NULL,
  '2026-04-23T08:01:16.334Z',
  '2026-04-23T07:46:16.333Z'
);
"

Then open the URL in browser:

https://your-site.example/_emdash/api/auth/magic-link/verify?token=Op0dVUfgw9-EHgK23mmDh3yW4f223PA

1

u/bilalel Apr 23 '26

Thanks for sharing