Add restriction on names
authordtluna <dtluna@openmailbox.org>
Mon, 24 Apr 2017 12:33:27 +0000 (15:33 +0300)
committerdtluna <dtluna@openmailbox.org>
Mon, 24 Apr 2017 12:34:54 +0000 (15:34 +0300)
lib/pleroma/user.ex

index 3ce07d510b433eb1a699273dbe0f8990a4caaf0b..5e579dc446105a2f5b17d1b248e7c8963133d298 100644 (file)
@@ -63,6 +63,7 @@ defmodule Pleroma.User do
     |> validate_confirmation(:password)
     |> unique_constraint(:email)
     |> unique_constraint(:nickname)
+    |> validate_format(:nickname, ~r/^[a-zA-Z\d]+$/)
 
     if changeset.valid? do
       hashed = Comeonin.Pbkdf2.hashpwsalt(changeset.changes[:password])