Skip to content

Commit

Permalink
[GREEN] Passed test for empty input.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesSetiawan committed Feb 22, 2024
1 parent eb6cdb6 commit f1d7385
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 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:
return JsonResponse({'msg': 'Email format is wrong.'}, status=400)
new_user = AppUser.objects.create_user(email=email,username=username,password=password)
Expand Down

0 comments on commit f1d7385

Please sign in to comment.