diff options
author | dtluna <dtluna@openmailbox.org> | 2017-04-08 16:28:50 +0300 |
---|---|---|
committer | dtluna <dtluna@openmailbox.org> | 2017-04-08 16:28:50 +0300 |
commit | 8f43992121a726df2faaf04bf918f32f708d10f8 (patch) | |
tree | d005314430cda65820634ed3e21210f5486c4863 /lib/mix/tasks | |
parent | b502d7981c5dec762f12829a8763e18b03ae445d (diff) | |
parent | 567ec494c523ded79c69f4d1bb0be9e51ca09837 (diff) | |
download | pleroma-8f43992121a726df2faaf04bf918f32f708d10f8.tar.gz pleroma-8f43992121a726df2faaf04bf918f32f708d10f8.zip |
Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma into develop
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 |