diff --git a/tubearchivist/home/templates/home/login.html b/tubearchivist/home/templates/home/login.html index d7bfed58..5e2c23de 100644 --- a/tubearchivist/home/templates/home/login.html +++ b/tubearchivist/home/templates/home/login.html @@ -29,6 +29,7 @@ {% for field in form %} {{ field }}
{% endfor %} + diff --git a/tubearchivist/home/views.py b/tubearchivist/home/views.py index 0f568d5c..1c16844d 100644 --- a/tubearchivist/home/views.py +++ b/tubearchivist/home/views.py @@ -161,10 +161,13 @@ class LoginView(View): """handle login post request""" form = AuthenticationForm(data=request.POST) if form.is_valid(): + next_url = request.POST.get('next') or "home" + print(f"next url: {next_url}") user = form.get_user() login(request, user) + return redirect(next_url) - return redirect("/") + return redirect("login") @staticmethod def read_config():