<s> from django . contrib . auth . decorators import login_required <EOL> from django . http import HttpResponseBadRequest <EOL> from django . shortcuts import get_object_or_404 <EOL> from hijack . decorators import hijack_require_http_methods , hijack_decorator <EOL> from hijack . helpers import login_user , redirect_to_next <EOL> from hijack . helpers import release_hijack as release_hijack_fx <EOL> from compat import get_user_model <EOL> @ hijack_decorator <EOL> @ hijack_require_http_methods <EOL> def login_with_id ( request , user_id ) : <EOL> try : <EOL> user_id = int ( user_id ) <EOL> except ValueError : <EOL> return HttpResponseBadRequest ( '<STR_LIT>' ) <EOL> user = get_object_or_404 ( get_user_model ( ) , pk = user_id ) <EOL> return login_user ( request , user ) <EOL> @ hijack_decorator <EOL> @ hijack_require_http_methods <EOL> def login_with_email ( request , email ) : <EOL> user = get_object_or_404 ( get_user_model ( ) , email = email ) <EOL> return login_user ( request , user ) <EOL> @ hijack_decorator <EOL> @ hijack_require_http_methods <EOL> def login_with_username ( request , username ) : <EOL> user = get_object_or_404 ( get_user_model ( ) , username = username ) <EOL> return login_user ( request , user ) <EOL> @ login_required <EOL> @ hijack_require_http_methods <EOL> def release_hijack ( request ) : <EOL> return release_hijack_fx ( request ) <EOL> @ login_required <EOL> @ hijack_require_http_methods <EOL> def disable_hijack_warning ( request ) : <EOL> request . session [ '<STR_LIT>' ] = False <EOL> return redirect_to_next ( request , default_url = '<STR_LIT:/>' ) </s>
