|
|
@ -5,7 +5,7 @@ from rest_framework.response import Response
|
|
|
|
from osinacore.models import *
|
|
|
|
from osinacore.models import *
|
|
|
|
from .serializers import *
|
|
|
|
from .serializers import *
|
|
|
|
from django.contrib.auth import authenticate, login
|
|
|
|
from django.contrib.auth import authenticate, login
|
|
|
|
from django.http import JsonResponse
|
|
|
|
from django.http import JsonResponse, HttpResponseRedirect
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@api_view(['POST'])
|
|
|
|
@api_view(['POST'])
|
|
|
@ -31,6 +31,7 @@ def register_customer(request):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@api_view(['POST'])
|
|
|
|
@api_view(['POST'])
|
|
|
|
def authenticate_customer(request):
|
|
|
|
def authenticate_customer(request):
|
|
|
|
if request.method == 'POST':
|
|
|
|
if request.method == 'POST':
|
|
|
@ -40,7 +41,7 @@ def authenticate_customer(request):
|
|
|
|
|
|
|
|
|
|
|
|
if user is not None:
|
|
|
|
if user is not None:
|
|
|
|
login(request, user)
|
|
|
|
login(request, user)
|
|
|
|
redirect_url = 'http://newosina.osinode.com'
|
|
|
|
redirect_url = 'https://newosina.osinode.com'
|
|
|
|
return JsonResponse({'success': True, 'redirect_url': redirect_url})
|
|
|
|
return HttpResponseRedirect(redirect_url)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return JsonResponse({'success': False, 'error': 'User does not exist'})
|
|
|
|
return JsonResponse({'success': False, 'error': 'User does not exist'})
|