projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
03c6148
)
Use changeset in user registration mix task.
author
Roger Braun
<roger@rogerbraun.net>
Sat, 15 Apr 2017 14:42:02 +0000
(16:42 +0200)
committer
Roger Braun
<roger@rogerbraun.net>
Sat, 15 Apr 2017 14:42:02 +0000
(16:42 +0200)
lib/mix/tasks/register_user.ex
patch
|
blob
|
history
diff --git
a/lib/mix/tasks/register_user.ex
b/lib/mix/tasks/register_user.ex
index 17535f19011880aab7f770bb172cbc90f01604b2..48236439b2cf8c459eb72d73a6a47bccbbc52833 100644
(file)
--- 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