diff --git a/cypress/e2e/add-forge-now-request-create.cy.js b/cypress/e2e/add-forge-now-request-create.cy.js --- a/cypress/e2e/add-forge-now-request-create.cy.js +++ b/cypress/e2e/add-forge-now-request-create.cy.js @@ -134,7 +134,7 @@ cy.get('#loginLink') .should('have.attr', 'href') - .and('include', `${this.Urls.login()}?next=${this.Urls.forge_add_create()}`); + .and('include', `${this.Urls.login()}?next_path=${this.Urls.forge_add_create()}`); }); it('should change tabs on click', function() { diff --git a/cypress/e2e/admin.cy.js b/cypress/e2e/admin.cy.js --- a/cypress/e2e/admin.cy.js +++ b/cypress/e2e/admin.cy.js @@ -98,7 +98,7 @@ cy.visit(this.Urls.admin_deposit()) .location('search') - .should('contain', `next=${this.Urls.admin_deposit()}`); + .should('contain', `next_path=${this.Urls.admin_deposit()}`); cy.adminLogin(); cy.visit(this.Urls.admin_deposit()); diff --git a/swh/web/add_forge_now/admin_views.py b/swh/web/add_forge_now/admin_views.py --- a/swh/web/add_forge_now/admin_views.py +++ b/swh/web/add_forge_now/admin_views.py @@ -3,7 +3,6 @@ # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information -from django.conf import settings from django.contrib.auth.decorators import user_passes_test from django.shortcuts import render @@ -11,7 +10,10 @@ from swh.web.auth.utils import is_add_forge_now_moderator -@user_passes_test(is_add_forge_now_moderator, login_url=settings.LOGIN_URL) +@user_passes_test( + is_add_forge_now_moderator, + redirect_field_name="next_path", +) def add_forge_now_requests_moderation_dashboard(request): """Moderation dashboard to allow listing current requests.""" return render( @@ -21,7 +23,10 @@ ) -@user_passes_test(is_add_forge_now_moderator, login_url=settings.LOGIN_URL) +@user_passes_test( + is_add_forge_now_moderator, + redirect_field_name="next_path", +) def add_forge_now_request_dashboard(request, request_id): """Moderation dashboard to allow listing current requests.""" return render( diff --git a/swh/web/add_forge_now/templates/add-forge-creation-form.html b/swh/web/add_forge_now/templates/add-forge-creation-form.html --- a/swh/web/add_forge_now/templates/add-forge-creation-form.html +++ b/swh/web/add_forge_now/templates/add-forge-creation-form.html @@ -13,12 +13,11 @@
You must be logged in to submit an add forge request. Please log in + href="{% url login_url %}?next_path={% url 'forge-add-create' %}"> + log in +
+ {% else %}