mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
User model doesn't need two changeset functions
This commit is contained in:
parent
9fb960fa5e
commit
e8de008466
@ -13,15 +13,8 @@ defmodule Chess.Auth.User do
|
|||||||
timestamps()
|
timestamps()
|
||||||
end
|
end
|
||||||
|
|
||||||
def changeset(struct) do
|
|
||||||
struct
|
|
||||||
|> cast(%{}, [:username, :password])
|
|
||||||
|> validate_required([:username, :password])
|
|
||||||
|> hash_password()
|
|
||||||
end
|
|
||||||
|
|
||||||
@doc false
|
@doc false
|
||||||
def changeset(struct, params) do
|
def changeset(struct, params \\ %{}) do
|
||||||
struct
|
struct
|
||||||
|> cast(params, [:username, :password])
|
|> cast(params, [:username, :password])
|
||||||
|> validate_required([:username, :password])
|
|> validate_required([:username, :password])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user