1
0
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:
Daniel Barber 2018-01-26 13:35:08 -05:00
parent 9fb960fa5e
commit e8de008466
Signed by: danbarber
GPG Key ID: 931D8112E0103DD8

View File

@ -13,15 +13,8 @@ defmodule Chess.Auth.User do
timestamps()
end
def changeset(struct) do
struct
|> cast(%{}, [:username, :password])
|> validate_required([:username, :password])
|> hash_password()
end
@doc false
def changeset(struct, params) do
def changeset(struct, params \\ %{}) do
struct
|> cast(params, [:username, :password])
|> validate_required([:username, :password])