diff --git a/osinaweb/osinacore/api/views.py b/osinaweb/osinacore/api/views.py index 560c33e0..c5f54978 100644 --- a/osinaweb/osinacore/api/views.py +++ b/osinaweb/osinacore/api/views.py @@ -6,7 +6,8 @@ from osinacore.models import * from .serializers import * from django.contrib.auth import authenticate, login from django.http import JsonResponse -from django.core.exceptions import ObjectDoesNotExist +from django.http import JsonResponse, HttpResponseRedirect +from django.urls import reverse @api_view(['POST']) @@ -30,6 +31,9 @@ def register_customer(request): +from django.http import JsonResponse, HttpResponseRedirect +from django.urls import reverse + @api_view(['POST']) def authenticate_customer(request): if request.method == 'POST': @@ -40,11 +44,8 @@ def authenticate_customer(request): except User.DoesNotExist: return JsonResponse({'success': False, 'error': 'User with this email does not exist'}) - login(request, user) - return JsonResponse({'success': True, 'user': { - 'id': user.id, - 'email': user.email, - 'username': user.username - }}) + # Redirect to the desired URL + redirect_url = 'http://newosina.osinode.com' # Change this URL to your desired redirect URL + return HttpResponseRedirect(redirect_url)