pleroma/lib/mix/tasks/register_user.ex

31 lines
714 B
Elixir
Raw Normal View History

2017-04-05 03:27:25 -07:00
defmodule Mix.Tasks.RegisterUser do
2018-07-12 16:02:18 -07:00
@moduledoc """
Manually register a local user
Usage: ``mix register_user <name> <nickname> <email> <bio> <password>``
Example: ``mix register_user lain lain@example.org "blushy-crushy fediverse idol + pleroma dev" pleaseDontHeckLain``
"""
2017-04-05 03:27:25 -07:00
use Mix.Task
alias Pleroma.{Repo, User}
@shortdoc "Register user"
def run([name, nickname, email, bio, password]) do
2018-04-10 12:05:53 -07:00
Mix.Task.run("app.start")
params = %{
2017-04-05 03:27:25 -07:00
name: name,
nickname: nickname,
email: email,
password: password,
password_confirmation: password,
2017-04-05 03:27:25 -07:00
bio: bio
}
user = User.register_changeset(%User{}, params)
2017-04-05 03:27:25 -07:00
Repo.insert!(user)
end
end