distraction.party/lib/mix/tasks/register_user.ex

23 lines
446 B
Elixir
Raw Normal View History

2017-04-05 10:27:25 +00:00
defmodule Mix.Tasks.RegisterUser do
use Mix.Task
alias Pleroma.{Repo, User}
@shortdoc "Register user"
def run([name, nickname, email, bio, password]) do
2018-04-10 19:05:53 +00:00
Mix.Task.run("app.start")
params = %{
2017-04-05 10:27:25 +00:00
name: name,
nickname: nickname,
email: email,
password: password,
password_confirmation: password,
2017-04-05 10:27:25 +00:00
bio: bio
}
user = User.register_changeset(%User{}, params)
2017-04-05 10:27:25 +00:00
Repo.insert!(user)
end
end