Separate Web modules related to Federation

This commit is contained in:
rustra
2020-01-23 00:55:07 +01:00
parent d1251280c5
commit 8ca5c0b320
42 changed files with 279 additions and 337 deletions

View File

@@ -0,0 +1,14 @@
defmodule MobilizonWeb.Email.Checker do
@moduledoc """
Provides a function to test emails against a "not so bad" regex.
"""
# TODO: simplify me!
@email_regex ~r/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
@doc """
Returns whether the email is valid.
"""
@spec valid?(String.t()) :: boolean
def valid?(email), do: email =~ @email_regex
end