<s> from __future__ import absolute_import , unicode_literals <EOL> from config . template_middleware import TemplateResponse <EOL> from gaecookie . decorator import no_csrf <EOL> from gaepermission import facade <EOL> from gaepermission . decorator import login_not_required , permissions <EOL> from permission_app . model import ADMIN <EOL> import settings <EOL> from tekton import router <EOL> from tekton . gae . middleware . redirect import RedirectResponse <EOL> from routes import admin <EOL> from routes . login import pending <EOL> @ login_not_required <EOL> def index ( _resp , token , ret_path = '<STR_LIT:/>' ) : <EOL> cmd = facade . login_facebook ( token , _resp ) <EOL> cmd ( ) <EOL> if cmd . pending_link : <EOL> pending_path = router . to_path ( pending . index , cmd . pending_link . key . id ( ) ) <EOL> user_email = cmd . main_user_from_email . email <EOL> facade . send_passwordless_login_link ( user_email , <EOL> settings . APP_URL + pending_path ) . execute ( ) <EOL> return TemplateResponse ( { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT:email>' : user_email } , '<STR_LIT>' ) <EOL> return RedirectResponse ( ret_path ) <EOL> @ permissions ( ADMIN ) <EOL> @ no_csrf <EOL> def form ( ) : <EOL> app = facade . get_facebook_app_data ( ) . execute ( ) . result <EOL> dct = { '<STR_LIT>' : router . to_path ( save ) , '<STR_LIT>' : app } <EOL> return TemplateResponse ( dct , '<STR_LIT>' ) <EOL> @ permissions ( ADMIN ) <EOL> def save ( app_id , token ) : <EOL> facade . save_or_update_facebook_app_data ( app_id , token ) . execute ( ) <EOL> return RedirectResponse ( admin ) </s>
