logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 567ec494c523ded79c69f4d1bb0be9e51ca09837
parent: f45dc475c7061042eb633a9ea39de54d7f24106c
Author: Roger Braun <roger@rogerbraun.net>
Date:   Wed,  5 Apr 2017 12:27:25 +0200

Add user registration mix task.

Diffstat:

Alib/mix/tasks/register_user.ex21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/lib/mix/tasks/register_user.ex 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