Skip to content

Commit

Permalink
Prevent multiple emails separated by commas in email field (#6018)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsubery authored Dec 21, 2024
1 parent e0fa893 commit 2cf42d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion priv/templates/phx.gen.auth/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ defmodule <%= inspect schema.module %> do
defp validate_email(changeset, opts) do
changeset
|> validate_required([:email])
|> validate_format(:email, ~r/^[^\s]+@[^\s]+$/, message: "must have the @ sign and no spaces")
|> validate_format(:email, ~r/^[^@,;\s]+@[^@,;\s]+$/,
message: "must have the @ sign and no spaces"
)
|> validate_length(:email, max: 160)
|> maybe_validate_unique_email(opts)
end
Expand Down

0 comments on commit 2cf42d6

Please sign in to comment.