Created
November 3, 2017 15:22
-
-
Save thebrianemory/a6351dae79be65ed02b56a39e67ff2c7 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/@your_domain.com$/) do # Change your_domain to your domain | |
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