From: Roger Braun Date: Wed, 5 Apr 2017 10:27:25 +0000 (+0200) Subject: Add user registration mix task. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=567ec494c523ded79c69f4d1bb0be9e51ca09837;p=akkoma Add user registration mix task. --- 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