From cf00a28be5ed7008e0ed0bdd5729dbd3dc7e5441 Mon Sep 17 00:00:00 2001 From: okbrandon Date: Thu, 17 Oct 2024 17:49:27 +0200 Subject: [PATCH] api: Bio check for user profile --- backend/api/views/users.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/api/views/users.py b/backend/api/views/users.py index 9d045b1a..9ab3a700 100644 --- a/backend/api/views/users.py +++ b/backend/api/views/users.py @@ -58,6 +58,8 @@ def patch(self, request, *args, **kwargs): return Response({"error": "Username is already taken"}, status=status.HTTP_409_CONFLICT) elif field == 'displayName' and not validate_displayname(data[field]): return Response({"error": "Invalid display name. Display name must be 4-16 characters long and contain only alphanumeric characters or null."}, status=status.HTTP_400_BAD_REQUEST) + elif field == 'bio' and not validate_bio(data[field]): + return Response({"error": "Invalid bio. Bio must be 280 characters or less."}, status=status.HTTP_400_BAD_REQUEST) elif field == 'email': if not validate_email(data[field]): return Response({"error": "Invalid email. Email must be a valid format and no longer than 64 characters."}, status=status.HTTP_400_BAD_REQUEST)