Improve overall configuration and support

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-11-15 17:35:47 +01:00
parent 06709ee46b
commit 403a32e996
14 changed files with 261 additions and 22 deletions

View File

@@ -0,0 +1,15 @@
defmodule Mobilizon.Service.EmailChecker do
@moduledoc """
Provides a function to test emails against a "not so bad" regex
"""
@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
end