<s> from django . conf import settings <EOL> from django . contrib . auth import login , REDIRECT_FIELD_NAME <EOL> from django . contrib . auth . decorators import login_required <EOL> from django . views . decorators . csrf import csrf_exempt , csrf_protect <EOL> from django . views . decorators . http import require_POST <EOL> from django . views . decorators . cache import never_cache <EOL> from social . utils import setting_name <EOL> from social . actions import do_auth , do_complete , do_disconnect <EOL> from social . apps . django_app . utils import psa <EOL> NAMESPACE = getattr ( settings , setting_name ( '<STR_LIT>' ) , None ) or '<STR_LIT>' <EOL> @ never_cache <EOL> @ psa ( '<STR_LIT>' . format ( NAMESPACE ) ) <EOL> def auth ( request , backend ) : <EOL> return do_auth ( request . backend , redirect_name = REDIRECT_FIELD_NAME ) <EOL> @ never_cache <EOL> @ csrf_exempt <EOL> @ psa ( '<STR_LIT>' . format ( NAMESPACE ) ) <EOL> def complete ( request , backend , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> return do_complete ( request . backend , _do_login , request . user , <EOL> redirect_name = REDIRECT_FIELD_NAME , * args , ** kwargs ) <EOL> @ never_cache <EOL> @ login_required <EOL> @ psa ( ) <EOL> @ require_POST <EOL> @ csrf_protect <EOL> def disconnect ( request , backend , association_id = None ) : <EOL> """<STR_LIT>""" <EOL> return do_disconnect ( request . backend , request . user , association_id , <EOL> redirect_name = REDIRECT_FIELD_NAME ) <EOL> def _do_login ( backend , user , social_user ) : <EOL> user . backend = '<STR_LIT>' . format ( backend . __module__ , <EOL> backend . __class__ . __name__ ) <EOL> login ( backend . strategy . request , user ) <EOL> if backend . setting ( '<STR_LIT>' , False ) : <EOL> expiration = social_user . expiration_datetime ( ) <EOL> if expiration : <EOL> try : <EOL> backend . strategy . request . session . set_expiry ( <EOL> expiration . seconds + expiration . days * <NUM_LIT> <EOL> ) <EOL> except OverflowError : <EOL> backend . strategy . request . session . set_expiry ( None ) </s>
