Add dot into allowed actor username
authorlsde <lsde@users.noreply.github.com>
Fri, 21 Sep 2018 14:08:55 +0000 (16:08 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 25 Sep 2018 09:41:15 +0000 (11:41 +0200)
One should have an oportunity to include a dot into the username.
Currently, it breaks the flow if one has an SSO in front of PeeTube which creates users with "name.surname".

server/helpers/custom-validators/activitypub/actor.ts

index 6958b2b00568b6094f9b7dd042a54ea2bf14e1e7..77c003cdf36dfa74df151c5e1104e9d6a09704f6 100644 (file)
@@ -27,7 +27,7 @@ function isActorPublicKeyValid (publicKey: string) {
     validator.isLength(publicKey, CONSTRAINTS_FIELDS.ACTORS.PUBLIC_KEY)
 }
 
-const actorNameRegExp = new RegExp('^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\\-_]+$')
+const actorNameRegExp = new RegExp('^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\\-_\.]+$')
 function isActorPreferredUsernameValid (preferredUsername: string) {
   return exists(preferredUsername) && validator.matches(preferredUsername, actorNameRegExp)
 }