jazzband / django-two-factor-auth

Complete Two-Factor Authentication for Django providing the easiest integration into most Django projects.
MIT License
1.71k stars 448 forks source link

change nav item logout link from get link to post button #691

Closed k-brahma closed 10 months ago

k-brahma commented 10 months ago

As this is the first time tring to contribute OSS, sorry in advance if any of my procedures are not appropriate.

navbar logout link changed to post form.

Description

example/templates/_base.html fixed to:

<li class="nav-item">
<form action="{% url 'logout' %}" method="post" style="display: inline;">
    {% csrf_token %}
    <button type="submit" class="nav-link" style="background: none; border: none; padding-top: 8px; margin: 0; text-decoration: none; cursor: pointer;">
        {% trans "Logout" %}
    </button>
</form>
</li>

Motivation and Context

original link below causes 405 response. <a class="nav-link" href="{% url 'logout' %}">{% trans "Logout" %}</a>

How Has This Been Tested?

the test below actually ends with some errors but not differ from origin/master's result.

python .\example\manage.py test --settings=tests.settings   

Screenshots (if appropriate):

Types of changes

Checklist:

k-brahma commented 10 months ago

Hi, I fixed it. Think that 'class="nav-link btn btn-link pt-2 m-0 text-decoration-none"' enough.

I visually confirmed that the nav-link works correctly in both expanded and collapsed states.

k-brahma commented 10 months ago

d-inline

So I launched local sever and checked if the class propery works. Think it's enough.

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (9159d1c) 95.52% compared to head (98a9e72) 95.52%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #691 +/- ## ======================================= Coverage 95.52% 95.52% ======================================= Files 78 78 Lines 3354 3354 Branches 377 377 ======================================= Hits 3204 3204 Misses 119 119 Partials 31 31 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.