Make lint happy
This commit is contained in:
parent
3cf6c2b7ea
commit
8bb2e52d2e
|
@ -771,19 +771,19 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_not_restricted_nickname(changeset, field) do
|
def validate_not_restricted_nickname(changeset, field) do
|
||||||
validate_change changeset, field, fn _, value ->
|
validate_change(changeset, field, fn _, value ->
|
||||||
valid? =
|
valid? =
|
||||||
Config.get([User, :restricted_nicknames])
|
Config.get([User, :restricted_nicknames])
|
||||||
|> Enum.all?(fn restricted_nickname ->
|
|> Enum.all?(fn restricted_nickname ->
|
||||||
String.downcase(value) != String.downcase(restricted_nickname)
|
String.downcase(value) != String.downcase(restricted_nickname)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if valid?, do: [], else: [nickname: "Invalid nickname"]
|
if valid?, do: [], else: [nickname: "Invalid nickname"]
|
||||||
end
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_email_not_in_blacklisted_domain(changeset, field) do
|
def validate_email_not_in_blacklisted_domain(changeset, field) do
|
||||||
validate_change changeset, field, fn _, value ->
|
validate_change(changeset, field, fn _, value ->
|
||||||
valid? =
|
valid? =
|
||||||
Config.get([User, :email_blacklist])
|
Config.get([User, :email_blacklist])
|
||||||
|> Enum.all?(fn blacklisted_domain ->
|
|> Enum.all?(fn blacklisted_domain ->
|
||||||
|
@ -794,9 +794,9 @@ def validate_email_not_in_blacklisted_domain(changeset, field) do
|
||||||
"." <> blacklisted_domain_downcase
|
"." <> blacklisted_domain_downcase
|
||||||
])
|
])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if valid?, do: [], else: [email: "Invalid email"]
|
if valid?, do: [], else: [email: "Invalid email"]
|
||||||
end
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def maybe_validate_required_email(changeset, true), do: changeset
|
def maybe_validate_required_email(changeset, true), do: changeset
|
||||||
|
|
Loading…
Reference in New Issue