Created
October 17, 2016 21:41
-
-
Save lasseebert/1bf83ce0ef8a6506599e8359fe553c9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def call(%{email: email}) do | |
| with :ok <- validate_email(email) do | |
| |> 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