Seed demo user in dev environment
This commit is contained in:
@@ -9,3 +9,13 @@
|
||||
#
|
||||
# We recommend using the bang functions (`insert!`, `update!`
|
||||
# and so on) as they will fail if something goes wrong.
|
||||
|
||||
if Mix.env() == :dev do
|
||||
alias Firehose.Accounts
|
||||
|
||||
# Create demo user if not already present
|
||||
unless Accounts.get_user_by_email("demo@example.com") do
|
||||
{:ok, user} = Accounts.register_user(%{email: "demo@example.com"})
|
||||
{:ok, {_user, _tokens}} = Accounts.update_user_password(user, %{password: "password123!"})
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user