diff options
author | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-06 12:13:54 -0600 |
---|---|---|
committer | Logan Hunt <loganhunt@simponic.xyz> | 2022-04-06 12:13:54 -0600 |
commit | 2055742911201258e6f755b3eb4031a1b09407f1 (patch) | |
tree | a8e0471cab55329e2e00b5d3e2011d37bb67fdb6 /lib/aggiedit/utils.ex | |
download | aggiedit-2055742911201258e6f755b3eb4031a1b09407f1.tar.gz aggiedit-2055742911201258e6f755b3eb4031a1b09407f1.zip |
Initial commit; generate auth code with phx.gen.auth; added room model and association; generate room model on domain of user emails; allow users to change their email
Diffstat (limited to 'lib/aggiedit/utils.ex')
-rw-r--r-- | lib/aggiedit/utils.ex | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/aggiedit/utils.ex b/lib/aggiedit/utils.ex new file mode 100644 index 0000000..492b36e --- /dev/null +++ b/lib/aggiedit/utils.ex @@ -0,0 +1,14 @@ +defmodule Aggiedit.Utils do + def get_email_domain(email) do + domain_split = Regex.named_captures(~r/^.*@(?<domain>.*)$/, email)["domain"] + |> String.downcase() + |> String.split(".") + IO.puts(inspect(domain_split)) + + if Enum.count(domain_split) >= 2 do + Enum.join(Enum.take(domain_split, -2), ".") + else + nil + end + end +end
\ No newline at end of file |