diff --git a/core/templates/core/403.jinja b/core/templates/core/403.jinja
index ec2ca620..194109a8 100644
--- a/core/templates/core/403.jinja
+++ b/core/templates/core/403.jinja
@@ -1,8 +1,10 @@
-{% extends "core/base.jinja" %}
+{% extends "core/login.jinja" %}
{% block content %}
{% trans %}403, Forbidden{% endtrans %}
+{{ super() }}
+
{% endblock %}
diff --git a/core/templates/core/login.jinja b/core/templates/core/login.jinja
index c30f0b18..9e7fadd7 100644
--- a/core/templates/core/login.jinja
+++ b/core/templates/core/login.jinja
@@ -1,5 +1,9 @@
{% extends "core/base.jinja" %}
+{% block title %}
+{% trans %}Login{% endtrans %}
+{% endblock %}
+
{% block content %}
{% if form.errors %}
diff --git a/core/views/__init__.py b/core/views/__init__.py
index 81891dd7..8aacaa16 100644
--- a/core/views/__init__.py
+++ b/core/views/__init__.py
@@ -3,11 +3,13 @@ from django.shortcuts import render
from django.http import HttpResponseForbidden, HttpResponseNotFound
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
from django.views.generic.base import View
+from django.contrib.auth.forms import AuthenticationForm
from core.models import Group
def forbidden(request):
- return HttpResponseForbidden(render(request, "core/403.jinja"))
+ return HttpResponseForbidden(render(request, "core/403.jinja", context={'next': request.path, 'form':
+ AuthenticationForm()}))
def not_found(request):
return HttpResponseNotFound(render(request, "core/404.jinja"))
diff --git a/eboutic/views.py b/eboutic/views.py
index 1519e0a9..18f5eaae 100644
--- a/eboutic/views.py
+++ b/eboutic/views.py
@@ -35,13 +35,15 @@ class EbouticMain(TemplateView):
def get(self, request, *args, **kwargs):
if not request.user.is_authenticated():
- return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs))
+ return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs) + "?next=" +
+ request.path)
self.make_basket(request)
return super(EbouticMain, self).get(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
if not request.user.is_authenticated():
- return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs))
+ return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs) + "?next=" +
+ request.path)
self.make_basket(request)
if 'add_product' in request.POST['action']:
self.add_product(request)
@@ -77,12 +79,14 @@ class EbouticCommand(TemplateView):
def get(self, request, *args, **kwargs):
if not request.user.is_authenticated():
- return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs))
+ return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs) + "?next=" +
+ request.path)
return HttpResponseRedirect(reverse_lazy('eboutic:main', args=self.args, kwargs=kwargs))
def post(self, request, *args, **kwargs):
if not request.user.is_authenticated():
- return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs))
+ return HttpResponseRedirect(reverse_lazy('core:login', args=self.args, kwargs=kwargs) + "?next=" +
+ request.path)
if 'basket_id' not in request.session.keys():
return HttpResponseRedirect(reverse_lazy('eboutic:main', args=self.args, kwargs=kwargs))
self.basket = Basket.objects.filter(id=request.session['basket_id']).first()