Skip to content

Commit

Permalink
Improve formatting of django template integration docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-schilling committed Sep 30, 2024
1 parent a800c1a commit 5cd9907
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 35 deletions.
38 changes: 20 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,34 +98,36 @@ This will add these paths to Django:
* ``/oauth2/callback`` where ADFS redirects back to after login. So make sure you set the redirect URI on ADFS to this.
* ``/oauth2/logout`` which logs out the user from both Django and ADFS.
```suggestion
Below is sample Django template code to use these paths depending if
you'd like to use GET or POST requests. Logging out was deprecated in
`Django 4.1 <https://docs.djangoproject.com/en/5.1/releases/4.1/#features-deprecated-in-4-1>`_.
- Using GET requests:
.. code-block:: html
.. code-block:: html
<a href="{% url 'django_auth_adfs:logout' %}">Logout</a>
<a href="{% url 'django_auth_adfs:login' %}">Login</a>
<a href="{% url 'django_auth_adfs:login-no-sso' %}">Login (no SSO)</a>
<a href="{% url 'django_auth_adfs:logout' %}">Logout</a>
<a href="{% url 'django_auth_adfs:login' %}">Login</a>
<a href="{% url 'django_auth_adfs:login-no-sso' %}">Login (no SSO)</a>
- Using POST requests:
.. code-block:: html+django
<form method="post" action="{% url 'django_auth_adfs:logout' %}">{% csrf_token %}
<button type="submit">Logout</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login' %}">{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login-no-sso' %}">{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login (no SSO)</button>
</form>
.. code-block:: html+django
<form method="post" action="{% url 'django_auth_adfs:logout' %}">
{% csrf_token %}
<button type="submit">Logout</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login-no-sso' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login (no SSO)</button>
</form>
Contributing
------------
Expand Down
37 changes: 20 additions & 17 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,27 @@ you'd like to use GET or POST requests. Logging out was deprecated in
- Using GET requests:
.. code-block:: html
.. code-block:: html
<a href="{% url 'django_auth_adfs:logout' %}">Logout</a>
<a href="{% url 'django_auth_adfs:login' %}">Login</a>
<a href="{% url 'django_auth_adfs:login-no-sso' %}">Login (no SSO)</a>
<a href="{% url 'django_auth_adfs:logout' %}">Logout</a>
<a href="{% url 'django_auth_adfs:login' %}">Login</a>
<a href="{% url 'django_auth_adfs:login-no-sso' %}">Login (no SSO)</a>
- Using POST requests:
.. code-block:: html+django
<form method="post" action="{% url 'django_auth_adfs:logout' %}">{% csrf_token %}
<button type="submit">Logout</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login' %}">{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login-no-sso' %}">{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login (no SSO)</button>
</form>
.. code-block:: html+django
<form method="post" action="{% url 'django_auth_adfs:logout' %}">
{% csrf_token %}
<button type="submit">Logout</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login</button>
</form>
<form method="post" action="{% url 'django_auth_adfs:login-no-sso' %}">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}">
<button type="submit">Login (no SSO)</button>
</form>

0 comments on commit 5cd9907

Please sign in to comment.