From: Roger Braun Date: Sat, 15 Apr 2017 14:42:02 +0000 (+0200) Subject: Use changeset in user registration mix task. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=40706b4c4fe4ae29bf01ef13bc3e79318773d66f;p=akkoma Use changeset in user registration mix task. --- diff --git a/lib/mix/tasks/register_user.ex b/lib/mix/tasks/register_user.ex index 17535f190..48236439b 100644 --- a/lib/mix/tasks/register_user.ex +++ b/lib/mix/tasks/register_user.ex @@ -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