Python django.contrib.auth.views.logout_then_login() Examples
The following are 3
code examples of django.contrib.auth.views.logout_then_login().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.contrib.auth.views
, or try the search function
.
Example #1
Source File: views.py From esdc-ce with Apache License 2.0 | 6 votes |
def logout(request): """ Log users out (destroy all sessions) and re-direct them to the main page. """ # Save profile and user object user = request.user profile = request.user.userprofile # Create guacamole object attached to request.user.username and with current guacamole password g = GuacamoleAuth(request) # Do a guacamole logout gcookie = g.logout() # We can then remove the cached configuration g.del_auth() # Get the response object response = logout_then_login(request) # Remove the guacamole cookie from response object response.delete_cookie(**gcookie['cookie']) # Setup i18n settings of the logged in user into session of an anonymous user profile.activate_locale(request) # Get auth logger and log the logout :) auth_logger.info('User %s successfully logged out from %s (%s)', user, get_client_ip(request), request.META.get('HTTP_USER_AGENT', '')) # Bye bye return response
Example #2
Source File: auth.py From zulip with Apache License 2.0 | 5 votes |
def logout_then_login(request: HttpRequest, **kwargs: Any) -> HttpResponse: return django_logout_then_login(request, kwargs)
Example #3
Source File: views.py From edx-analytics-dashboard with GNU Affero General Public License v3.0 | 5 votes |
def insights_logout_then_login(request, login_url=reverse_lazy('login')): """ Logout then login """ permissions.revoke_user_course_permissions(request.user) return logout_then_login(request, login_url=login_url)