Auto logout/destroy session after Password Change in Django

Sayantan

I am using django framework and I need to auto logout users after password changes (not password reset via mail).

I am using django's :"contrib.auth.views.password_change" to help me do this,

i.e., I'm not having a separate view and as a result I'm also using password_change_done view of Django.

I need to know whether there's any way I can auto logout/destroy sessions after password change while using django's default views?

Aviah Laor

password_change has a post_change_redirect, so you can replace it:

from django.contrib.auth.views import password_change
from django.core.urlresolvers import reverse

def my_password_change(request):
    return password_change(request=request,post_change_redirect=reverse('logout'))

Then in your urls.py, set my_password_change as the view that accepts the passowrd change request:

url(r'^password_change/done/$',my_password_change,name="my_password_change")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Liferay : Redirect to change Password after auto login

From Dev

Ask user to change their password after their password expires, but not during their session

From Dev

Session auto logout after inactivity

From Dev

Django password change

From Dev

Django form to change password

From Dev

Django form to change password

From Dev

Windows Azure Active Directory Auto password change

From Dev

Change password page for one user with session

From Dev

Invalid session token in Parse, after changing password

From Dev

How to add a success message after django allauth change password view has returned response

From Dev

how to change auto layout constraints after add

From Dev

Authentication failure in Heroku CLI after password change

From Dev

Automatic Login Via Devise after Password Change

From Dev

How to change the root password after memsql install?

From Dev

Can not login to mysql 5.7.9 after change password

From Dev

Change password validation rules after application starts

From Dev

MembershipProvider validation fails after password change

From Dev

Change keyring password after resetting password with "passwd" : Ubuntu 13.10

From Dev

Django - trigger auto_now field change

From Dev

django auth: password change template customization

From Dev

Django 1.6 - templates for password change/reset

From Dev

Django - revisiting "change password at next login”

From Dev

Django allauth change password without logging out

From Dev

Django 1.6 - templates for password change/reset

From Dev

Django password_change view & PasswordChangeForm not working

From Dev

Django change password without logging again

From Dev

How to auto redirect a user in Symfony after a session time out?

From Dev

After password reset remove all session cookies for that user

From Dev

Authenticate user after password reset in Django

Related Related

  1. 1

    Liferay : Redirect to change Password after auto login

  2. 2

    Ask user to change their password after their password expires, but not during their session

  3. 3

    Session auto logout after inactivity

  4. 4

    Django password change

  5. 5

    Django form to change password

  6. 6

    Django form to change password

  7. 7

    Windows Azure Active Directory Auto password change

  8. 8

    Change password page for one user with session

  9. 9

    Invalid session token in Parse, after changing password

  10. 10

    How to add a success message after django allauth change password view has returned response

  11. 11

    how to change auto layout constraints after add

  12. 12

    Authentication failure in Heroku CLI after password change

  13. 13

    Automatic Login Via Devise after Password Change

  14. 14

    How to change the root password after memsql install?

  15. 15

    Can not login to mysql 5.7.9 after change password

  16. 16

    Change password validation rules after application starts

  17. 17

    MembershipProvider validation fails after password change

  18. 18

    Change keyring password after resetting password with "passwd" : Ubuntu 13.10

  19. 19

    Django - trigger auto_now field change

  20. 20

    django auth: password change template customization

  21. 21

    Django 1.6 - templates for password change/reset

  22. 22

    Django - revisiting "change password at next login”

  23. 23

    Django allauth change password without logging out

  24. 24

    Django 1.6 - templates for password change/reset

  25. 25

    Django password_change view & PasswordChangeForm not working

  26. 26

    Django change password without logging again

  27. 27

    How to auto redirect a user in Symfony after a session time out?

  28. 28

    After password reset remove all session cookies for that user

  29. 29

    Authenticate user after password reset in Django

HotTag

Archive