db/seeds.rb creates admin with password too short for Devise validation #71

Closed
opened 2026-03-10 18:03:39 +01:00 by barbie-bot · 0 comments

Bug

db/seeds.rb creates the initial admin user with password 'admin' (5 characters), but Devise requires a minimum password length of 8 characters. As a result, seeding fails silently — the error is caught and printed, but no admin account is created.

Steps to reproduce

bundle exec rails db:seed

Output:

Creating admin account 'admin@localhost' with password 'admin'...failed. Password is too short (minimum is 8 characters)

Expected behavior

Seeding should create a working admin account.

Fix

Change the default seed password to meet Devise's minimum length requirement (8 characters), e.g. 'admin123', or better yet use a randomly generated password and print it to stdout so the user knows what to use.

## Bug `db/seeds.rb` creates the initial admin user with password `'admin'` (5 characters), but Devise requires a minimum password length of **8 characters**. As a result, seeding fails silently — the error is caught and printed, but no admin account is created. ## Steps to reproduce ``` bundle exec rails db:seed ``` Output: ``` Creating admin account 'admin@localhost' with password 'admin'...failed. Password is too short (minimum is 8 characters) ``` ## Expected behavior Seeding should create a working admin account. ## Fix Change the default seed password to meet Devise's minimum length requirement (8 characters), e.g. `'admin123'`, or better yet use a randomly generated password and print it to stdout so the user knows what to use.
Sign in to join this conversation.