Forbid creating usernames with uppercase characters

We don't actually enforce anything on the ActivityPub level, only
user-facing interfaces

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-11-17 19:14:55 +01:00
parent c28dae45bb
commit e6077d0dc3
55 changed files with 6436 additions and 4808 deletions

View File

@@ -120,7 +120,8 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
) do
args = Map.put(args, :user_id, user.id)
with args <- save_attached_pictures(args),
with args <- Map.update(args, :preferred_username, "", &String.downcase/1),
args <- save_attached_pictures(args),
{:ok, %Actor{} = new_person} <- Actors.new_person(args) do
{:ok, new_person}
end
@@ -220,6 +221,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Person do
user_actor <- Users.get_actor_for_user(user),
no_actor <- is_nil(user_actor),
{:no_actor, true} <- {:no_actor, no_actor},
args <- Map.update(args, :preferred_username, "", &String.downcase/1),
args <- Map.put(args, :user_id, user.id),
args <- save_attached_pictures(args),
{:ok, %Actor{} = new_person} <- Actors.new_person(args, true) do