NEW: user accounts (#3)
This commit is contained in:
parent
d02c491028
commit
9990771c18
31 changed files with 1640 additions and 207 deletions
20
lib/mix/tasks/planner.register.ex
Normal file
20
lib/mix/tasks/planner.register.ex
Normal file
|
@ -0,0 +1,20 @@
|
|||
defmodule Mix.Tasks.Planner.Register do
|
||||
use Mix.Task
|
||||
|
||||
alias Planner.Accounts
|
||||
|
||||
@shortdoc "Register a new Planner user"
|
||||
|
||||
def run([email, password]) do
|
||||
Mix.Task.run("app.start")
|
||||
|
||||
case Accounts.register_user(%{email: email, password: password}) do
|
||||
{:ok, _} ->
|
||||
Mix.shell().info("User created successfully.")
|
||||
|
||||
{:error, %Ecto.Changeset{} = changeset} ->
|
||||
IO.inspect(changeset)
|
||||
Mix.shell().error("There was a problem.")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue