diff options
| author | Roger Braun <roger@rogerbraun.net> | 2017-04-05 12:27:25 +0200 | 
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2017-04-05 12:27:25 +0200 | 
| commit | 567ec494c523ded79c69f4d1bb0be9e51ca09837 (patch) | |
| tree | 43b4179c94497354eada01baaf983985ad911952 /lib/mix/tasks | |
| parent | f45dc475c7061042eb633a9ea39de54d7f24106c (diff) | |
| download | pleroma-567ec494c523ded79c69f4d1bb0be9e51ca09837.tar.gz pleroma-567ec494c523ded79c69f4d1bb0be9e51ca09837.zip | |
Add user registration mix task.
Diffstat (limited to 'lib/mix/tasks')
| -rw-r--r-- | lib/mix/tasks/register_user.ex | 21 | 
1 files changed, 21 insertions, 0 deletions
| diff --git a/lib/mix/tasks/register_user.ex b/lib/mix/tasks/register_user.ex new file mode 100644 index 000000000..e2f36c34c --- /dev/null +++ b/lib/mix/tasks/register_user.ex @@ -0,0 +1,21 @@ +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, []) +    user = %User{ +      name: name, +      nickname: nickname, +      email: email, +      password_hash: Comeonin.Pbkdf2.hashpwsalt(password), +      bio: bio +    } + +    user = %{ user | ap_id: User.ap_id(user) } + +    Repo.insert!(user) +  end +end | 
