Packages

Addict allows you to manage users on your Phoenix app easily. Register, login, logout, recover password and password updating is available off-the-shelf.

Current section

Files

Jump to
addict lib addict interactors inject_hash.ex
Raw

lib/addict/interactors/inject_hash.ex

defmodule Addict.Interactors.InjectHash do
alias Addict.Interactors.GenerateEncryptedPassword
@doc """
Adds `"encrypted_password"` and drops `"password"` from provided hash.
Returns the new hash with `"encrypted_password"` and without `"password"`.
"""
def call(user_params) do
user_params
|> Map.put("encrypted_password", GenerateEncryptedPassword.call(user_params["password"]))
|> Map.drop(["password"])
end
end