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 %}
HttpResponse: """View to retrieve the message source for a given request history entry""" diff --git a/swh/web/api/templates/api.html b/swh/web/api/templates/api.html --- a/swh/web/api/templates/api.html +++ b/swh/web/api/templates/api.html @@ -38,9 +38,11 @@
  • Rate limiting
  • -
  • - Authentication -
  • + {% if oidc_enabled %} +
  • + Authentication +
  • + {% endif %}

    Endpoint index

    @@ -277,28 +279,30 @@ X-RateLimit-Remaining: 119 X-RateLimit-Reset: 1620639052 -

    Authentication

    -

    - It is possible to perform authenticated requests to the Web API through the use of a bearer token - sent in HTTP Authorization headers. -
    - To obtain such a token, an account to the - Software Heritage Authentication service must be created. -
    - To generate and manage bearer tokens, a dedicated interface is available on the - user profile page once logged in. -

    -

    - The following shows how to perform an authenticated request to the Web API using curl. -

    export TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhMTMxYTQ1My1hM2IyLTQwMTUtO...
    -curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}api/...
    -

    -

    - Authenticated requests can be used to lift rate limiting if the user account has the adequate - permission. - If you are in such a need, please contact us - and we will review your request. -

    + {% if oidc_enabled %} +

    Authentication

    +

    + It is possible to perform authenticated requests to the Web API through the use of a bearer token + sent in HTTP Authorization headers. +
    + To obtain such a token, an account to the + Software Heritage Authentication service must be created. +
    + To generate and manage bearer tokens, a dedicated interface is available on the + user profile page once logged in. +

    +

    + The following shows how to perform an authenticated request to the Web API using curl. +

    export TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhMTMxYTQ1My1hM2IyLTQwMTUtO...
    +  curl -H "Authorization: Bearer ${TOKEN}" {{ site_base_url }}api/...
    +

    +

    + Authenticated requests can be used to lift rate limiting if the user account has the adequate + permission. + If you are in such a need, please contact us + and we will review your request. +

    + {% endif %}