diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-12-03 01:28:54 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2020-12-03 01:28:54 +0000 |
commit | 05879a3b3ef656fd167e40e0a62c7a3c9f41facd (patch) | |
tree | a38ee456fec02bba2ef11398c38ff9f9af2e4123 /lib | |
parent | c91ca482c2df85006d1967591730407230448316 (diff) | |
parent | 5d1548609843952bffa514af96e714756a7091ec (diff) | |
download | pleroma-05879a3b3ef656fd167e40e0a62c7a3c9f41facd.tar.gz |
Merge branch '2339-local-remote-mixup' into 'develop'
User: Don't allow local users in remote changesets
Closes #2339
See merge request pleroma/pleroma!3185
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/user.ex | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index bcd5256c8..4b3a9d690 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -473,6 +473,18 @@ defmodule Pleroma.User do |> validate_length(:bio, max: bio_limit) |> validate_length(:name, max: name_limit) |> validate_fields(true) + |> validate_non_local() + end + + defp validate_non_local(cng) do + local? = get_field(cng, :local) + + if local? do + cng + |> add_error(:local, "User is local, can't update with this changeset.") + else + cng + end end def update_changeset(struct, params \\ %{}) do |