Skip to content

Instantly share code, notes, and snippets.

@lasseebert
Created October 17, 2016 21:41
Show Gist options
  • Select an option

  • Save lasseebert/1bf83ce0ef8a6506599e8359fe553c9a to your computer and use it in GitHub Desktop.

Select an option

Save lasseebert/1bf83ce0ef8a6506599e8359fe553c9a to your computer and use it in GitHub Desktop.
def call(%{email: email}) do
with :ok <- validate_email(email) do
email
|> build_changeset
|> create_user
end
end
#...
defp validate_email(email) do
case String.match?(email, ~r/@/) do
true -> :ok
false -> {:error, :invalid_email}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment