diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index c75b3ce..86f05eb 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 67cb0f9..4bae6d7 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/templates/core/shipment_request.html b/core/templates/core/shipment_request.html index 3b94464..d6469db 100644 --- a/core/templates/core/shipment_request.html +++ b/core/templates/core/shipment_request.html @@ -410,7 +410,7 @@ const errorMessage = document.getElementById('pricingErrorMessage'); if (pickupLat && pickupLng && deliveryLat && deliveryLng && weight) { - fetch('{% url "api_pricing" %}', { + fetch('{% url "api_calculate_price" %}', { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/core/urls.py b/core/urls.py index 6e4d483..759da82 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,4 +1,5 @@ from django.urls import path +from django.contrib.auth import views as auth_views from . import views, api_views urlpatterns = [ @@ -11,7 +12,7 @@ urlpatterns = [ path('login/', views.CustomLoginView.as_view(), name='login'), path('login/2fa/select/', views.select_2fa_method, name='select_2fa_method'), path('login/2fa/verify/', views.verify_2fa_otp, name='verify_2fa_otp'), - path('logout/', views.logout, name='logout'), + path('logout/', views.logout_view, name='logout'), path('dashboard/', views.dashboard, name='dashboard'), path('shipment-request/', views.shipment_request, name='shipment_request'), @@ -34,6 +35,12 @@ urlpatterns = [ path('rate-driver//', views.rate_driver, name='rate_driver'), + # Password Reset + path('password-reset/', auth_views.PasswordResetView.as_view(template_name='core/password_reset_form.html', email_template_name='core/emails/password_reset_email.html', subject_template_name='core/emails/password_reset_subject.txt'), name='password_reset'), + path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='core/password_reset_done.html'), name='password_reset_done'), + path('password-reset-confirm///', auth_views.PasswordResetConfirmView.as_view(template_name='core/password_reset_confirm.html'), name='password_reset_confirm'), + path('password-reset-complete/', auth_views.PasswordResetCompleteView.as_view(template_name='core/password_reset_complete.html'), name='password_reset_complete'), + # OTP Login / Passwordless path('ajax/request-login-otp/', views.request_login_otp, name='request_login_otp'), path('ajax/verify-login-otp/', views.verify_login_otp, name='verify_login_otp'), @@ -61,6 +68,7 @@ urlpatterns = [ # API Endpoints (for Mobile App) path('api/v1/parcels/', api_views.ParcelListCreateView.as_view(), name='api_parcel_list'), path('api/v1/parcels//', api_views.ParcelDetailView.as_view(), name='api_parcel_detail'), - path('api/v1/pricing/', api_views.PriceCalculatorView.as_view(), name='api_pricing'), path('api/v1/calculate-price/', api_views.PriceCalculatorView.as_view(), name='api_calculate_price'), + path('api/v1/pricing/', api_views.PriceCalculatorView.as_view(), name='api_pricing'), + path('api/v1/calculate-price/', api_views.PriceCalculatorView.as_view(), name='api_calculate_price'), path('api/v1/profile/', api_views.UserProfileView.as_view(), name='api_profile'), ] diff --git a/core/views.py b/core/views.py index edf3331..6020839 100644 --- a/core/views.py +++ b/core/views.py @@ -37,6 +37,11 @@ from io import BytesIO import base64 from .pricing import get_pricing_breakdown # Import pricing logic +def logout_view(request): + logout(request) + messages.success(request, _("You have been logged out.")) + return redirect("index") + def index(request): # If tracking_id is present, redirect to the new track view tracking_id = request.GET.get('tracking_id') @@ -338,6 +343,14 @@ def shipment_request(request): platform_profile = PlatformProfile.objects.first() google_maps_api_key = platform_profile.google_maps_api_key if platform_profile else None + # DEBUG: Verify reverse + try: + url1 = reverse('api_pricing') + url2 = reverse('api_calculate_price') + print(f"DEBUG REVERSE: api_pricing={url1}, api_calculate_price={url2}") + except Exception as e: + print(f"DEBUG REVERSE ERROR: {e}") + return render(request, 'core/shipment_request.html', { 'form': form, 'google_maps_api_key': google_maps_api_key