Skip to content

Commit

Permalink
api: Bio check for user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
okbrandon committed Oct 17, 2024
1 parent b5c9831 commit cf00a28
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/api/views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cf00a28

Please sign in to comment.