Created
November 22, 2017 21:01
-
-
Save thebrianemory/06b2c9fcd9afe9772df6ee312efd2f6d to your computer and use it in GitHub Desktop.
This file contains 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
defp authenticate(%{info: info, uid: uid}) do | |
email = Map.get(info, :email) | |
name = Developer.format_username(Map.get(info, :name)) | |
case String.match?(email, ~r/@yourdomain.com$/) do # Add your domain on this line | |
true -> | |
attrs = %{ | |
email: email, | |
username: name, | |
google_id: uid | |
} | |
Developer.find_or_create(Repo, attrs) | |
_ -> | |
{:error, email} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment