Commit 40706b4c authored by lain's avatar lain
Browse files

Use changeset in user registration mix task.

parent 03c6148b
......@@ -6,15 +6,17 @@ defmodule Mix.Tasks.RegisterUser do
@shortdoc "Register user"
def run([name, nickname, email, bio, password]) do
ensure_started(Repo, [])
user = %User{
params = %{
name: name,
nickname: nickname,
email: email,
password_hash: Comeonin.Pbkdf2.hashpwsalt(password),
password: password,
password_confirmation: password,
bio: bio
}
user = %{ user | ap_id: User.ap_id(user), following: User.ap_followers(user) }
user = User.register_changeset(%User{}, params)
Repo.insert!(user)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment