|
|
|
@ -110,7 +110,7 @@ class RegistrationView(APIView): |
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def post(request): |
|
|
|
def post(request): |
|
|
|
try: |
|
|
|
try: |
|
|
|
get_user_model().objects.get(email=request.JSON['email'].lower()) |
|
|
|
user = get_user_model().objects.get(email=request.JSON['email'].lower()) |
|
|
|
return Response('user already exist', status=403) |
|
|
|
return Response('user already exist', status=403) |
|
|
|
except get_user_model().DoesNotExist: |
|
|
|
except get_user_model().DoesNotExist: |
|
|
|
password = request.JSON.get('password') |
|
|
|
password = request.JSON.get('password') |
|
|
|
@ -145,7 +145,7 @@ class LoginView(APIView): |
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def post(request): |
|
|
|
def post(request): |
|
|
|
password = request.JSON.get('password') |
|
|
|
password = request.JSON.get('password') |
|
|
|
email = request.JSON.get('email') |
|
|
|
email = request.JSON.get('email').lower() |
|
|
|
if not request.user.is_authenticated(): |
|
|
|
if not request.user.is_authenticated(): |
|
|
|
if not password == "skillbox": |
|
|
|
if not password == "skillbox": |
|
|
|
user = auth.authenticate(email=email, password=request.JSON.get('password')) |
|
|
|
user = auth.authenticate(email=email, password=request.JSON.get('password')) |
|
|
|
|