Skip to content

Commit

Permalink
Merge pull request #116 from technicalcapt/master
Browse files Browse the repository at this point in the history
remove warning cast/4 deprecated
  • Loading branch information
trenpixster authored Jan 31, 2017
2 parents 2a76f82 + 5991a46 commit b5d8d23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/addict/interactors/validate_user_for_registration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Returns `{:ok, []}` or `{:error, [errors]}`

def call(user_params, configs \\ Addict.Configs) do
struct(configs.user_schema)
|> cast(user_params, ~w(email), ~w())
|> cast(user_params, [:email])
|> validate_required(:email)
|> validate_format(:email, ~r/.+@.+/)
|> unique_constraint(:email)
|> validate_password(user_params["password"], configs.password_strategies)
Expand All @@ -37,7 +38,8 @@ Returns `{:ok, []}` or `{:error, [errors]}`

defp validate_password(changeset, password, password_strategies) do
%Addict.PasswordUser{}
|> Ecto.Changeset.cast(%{password: password}, ~w(password), [])
|> Ecto.Changeset.cast(%{password: password}, [:password])
|> Ecto.Changeset.validate_required(:password)
|> ValidatePassword.call(password_strategies)
|> do_validate_password(changeset.errors)
end
Expand Down

0 comments on commit b5d8d23

Please sign in to comment.