/usr/lib/python2.7/dist-packages/hijack/views.py is in python-django-hijack 2.0.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # -*- encoding: utf-8 -*-
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.http import HttpResponseBadRequest
from hijack.decorators import hijack_decorator
from hijack.helpers import login_user, redirect_to_next
from hijack.helpers import release_hijack as release_hijack_fx
from compat import get_user_model
@hijack_decorator
def login_with_id(request, user_id):
# input(user_id) is unicode
try:
user_id = int(user_id)
except ValueError:
return HttpResponseBadRequest('user_id must be an integer value.')
user = get_object_or_404(get_user_model(), pk=user_id)
return login_user(request, user)
@hijack_decorator
def login_with_email(request, email):
user = get_object_or_404(get_user_model(), email=email)
return login_user(request, user)
@hijack_decorator
def login_with_username(request, username):
user = get_object_or_404(get_user_model(), username=username)
return login_user(request, user)
@login_required
def release_hijack(request):
return release_hijack_fx(request)
@login_required
def disable_hijack_warning(request):
request.session['display_hijack_warning'] = False
return redirect_to_next(request, default_url='/')
|