Validate username format in what seem to be WIP API?

This commit is contained in:
fnux 2020-05-01 11:11:24 +02:00
parent ac7d9df7a9
commit 26916f7def

View file

@ -511,6 +511,10 @@ class UserCreateAPI(APIView):
if username == "" or not username:
return Response('Please supply a username.', 400)
if not is_username_valid(username):
return Response('Username is not valid.', 400)
try:
validate_email(email)
except ValidationError: