Skip to content

Commit 2cf42d6

Browse files
authored
Prevent multiple emails separated by commas in email field (#6018)
1 parent e0fa893 commit 2cf42d6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

priv/templates/phx.gen.auth/schema.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ defmodule <%= inspect schema.module %> do
4646
defp validate_email(changeset, opts) do
4747
changeset
4848
|> validate_required([:email])
49-
|> validate_format(:email, ~r/^[^\s]+@[^\s]+$/, message: "must have the @ sign and no spaces")
49+
|> validate_format(:email, ~r/^[^@,;\s]+@[^@,;\s]+$/,
50+
message: "must have the @ sign and no spaces"
51+
)
5052
|> validate_length(:email, max: 160)
5153
|> maybe_validate_unique_email(opts)
5254
end

0 commit comments

Comments
 (0)