fix: email error handling on magic auth
This commit is contained in:
parent
ca88675dbf
commit
1cb16bf176
2 changed files with 2 additions and 6 deletions
|
|
@ -44,10 +44,8 @@ class MagicGenerateEndpoint(APIView):
|
|||
return Response(exc.get_error_dict(), status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
origin = request.META.get("HTTP_ORIGIN", "/")
|
||||
email = request.data.get("email", False)
|
||||
email = request.data.get("email", "").strip().lower()
|
||||
try:
|
||||
# Clean up the email
|
||||
email = email.strip().lower()
|
||||
validate_email(email)
|
||||
adapter = MagicCodeProvider(request=request, key=email)
|
||||
key, token = adapter.initiate()
|
||||
|
|
|
|||
|
|
@ -39,10 +39,8 @@ class MagicGenerateSpaceEndpoint(APIView):
|
|||
return Response(exc.get_error_dict(), status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
origin = base_host(request=request, is_space=True)
|
||||
email = request.data.get("email", False)
|
||||
email = request.data.get("email", "").strip().lower()
|
||||
try:
|
||||
# Clean up the email
|
||||
email = email.strip().lower()
|
||||
validate_email(email)
|
||||
adapter = MagicCodeProvider(request=request, key=email)
|
||||
key, token = adapter.initiate()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue