Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
40706b4c
Commit
40706b4c
authored
Apr 15, 2017
by
lain
Browse files
Use changeset in user registration mix task.
parent
03c6148b
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/mix/tasks/register_user.ex
View file @
40706b4c
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment