python - Run javascript on django login and logout events -


is possible execute javascript (in template) after successful login event or after successful logout event. if yes, how?

i don't want asscociate login button click or logout button click on js level because

  • clicking button not guarantee successful login/logout event
  • i have lot of login , logout buttons, many templates , partials looking centralized solution

by way using python-social-auth.

here's how i'd approach it.

  1. make view has template contains js want execute on login (it blank page redirects somewhere else, or template extends template... there myriad of ways dry here, think).

  2. set social_auth_login_redirect_url, social_auth_new_user_redirect_url, and/or social_auth_new_association_redirect_url (whichever of decide use in step 3) in settings.py.

  3. make entry in urls.py makes view accessible either social_auth_login_redirect_url (or both social_auth_new_user_redirect_url , social_auth_new_association_redirect_url, if want execute new users of site).

i'm getting settings variables django-social-auth docs.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -