2017-04-05 10:27:25 +00:00
|
|
|
defmodule Mix.Tasks.RegisterUser do
|
|
|
|
use Mix.Task
|
|
|
|
import Mix.Ecto
|
|
|
|
alias Pleroma.{Repo, User}
|
|
|
|
|
|
|
|
@shortdoc "Register user"
|
|
|
|
def run([name, nickname, email, bio, password]) do
|
|
|
|
ensure_started(Repo, [])
|
2017-04-15 14:42:02 +00:00
|
|
|
|
|
|
|
params = %{
|
2017-04-05 10:27:25 +00:00
|
|
|
name: name,
|
|
|
|
nickname: nickname,
|
|
|
|
email: email,
|
2017-04-15 14:42:02 +00:00
|
|
|
password: password,
|
|
|
|
password_confirmation: password,
|
2017-04-05 10:27:25 +00:00
|
|
|
bio: bio
|
|
|
|
}
|
|
|
|
|
2017-04-15 14:42:02 +00:00
|
|
|
user = User.register_changeset(%User{}, params)
|
2017-04-05 10:27:25 +00:00
|
|
|
|
|
|
|
Repo.insert!(user)
|
|
|
|
end
|
|
|
|
end
|