mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-25 09:22:22 +00:00
403a32e996
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
15 lines
458 B
Elixir
15 lines
458 B
Elixir
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
|