mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-12-23 15:55:04 +01:00
Use changeset in user registration mix task.
This commit is contained in:
parent
03c6148bb3
commit
40706b4c4f
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user