Skip to content

Commit

Permalink
[GREEN] Passed test for email/username already exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesSetiawan committed Feb 22, 2024
1 parent cd22c06 commit 96d12b1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def post(self, request):
username = data['username']
password = data['password']
email = data['email']
if AppUser.objects.filter(username = username).exists() or AppUser.objects.filter(email = email).exists():
return JsonResponse({'msg': 'Username and/or email already taken!'}, status=400)
if username == '' or password == '' or email == '':
return JsonResponse({'msg': 'Empty input! Make sure all the fields are filled.'}, status=400)
if re.match(r'^[\w\.-]+@[\w\.-]+\.\w+$', email) is None:
Expand Down

0 comments on commit 96d12b1

Please sign in to comment.