Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting to hide the intermediary logout page #1922

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wgordon17
Copy link
Contributor

Description

I would like to avoid showing the unnecessary, intermediary confirmation signout page.

The need for an intermediary page is documented in the django-allauth docs: https://django-allauth.readthedocs.io/en/latest/views.html#logout-account-logout

This change will still use the intermediary logout page, but instead auto-submit the form via JavaScript. This has the added benefit of still degrading to using the form in the case that JavaScript is disabled.

The concept comes from an old Django issue: https://code.djangoproject.com/ticket/15619#comment:38

Rationale

This is something that I believe would benefit the larger community. It's an optional feature with the default value ensuring that it does not change the expected behavior.

Use case(s) / visualization(s)

This hides an unnecessary, intermediary page and increases user UX by preventing clicks where not necessary.

from django.conf import settings


def exposed_settings(request):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def exposed_settings(request):
def expose_settings(request):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long lead time. This has now been addressed

@wgordon17 wgordon17 force-pushed the add-option-disable-intermediate-logout-page branch from 7080d58 to f872b4f Compare February 17, 2019 03:09
@BoPeng
Copy link
Contributor

BoPeng commented Jan 27, 2020

I have been searching for a solution for this... I am merging this to my project now.

{# Hide form - prevents user confusion by seeing an auto-submitting form #}
<script>document.getElementsByClassName('container')[0].style.display = 'none';</script>
{% endif %}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The document might have multiple container so if there is another container (e.g. in the header) this script will fail. I would suggest wrapping the form in a div

<div style='display:none'>
<form ...> </form>
</div>

instead.

{# Hide form - prevents user confusion by seeing an auto-submitting form #}
<script>document.getElementsByClassName('container')[0].style.display = 'none';</script>
{% endif %}

<h1>{% trans "Sign Out" %}</h1>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you indeed use a display:none div, this can be left out of the div and becomes something like

<h1>{% trans "Signing Out" %}</h1>

so that users can see a Sinning Out message instead of a blank page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants