def twitter(self): next = self.field("next") context = self.field("context", "login") state = context + ":" + next secure = not context == "login" if secure: appier.ensure("admin") url = self.ensure_twitter_api(state = state, refresh = secure) if url: return self.redirect(url) return self.redirect( next or self.url_for(self.owner.admin_login_redirect) )
def facebook(self): next = self.field("next") context = self.field("context", "login") state = context + ":" + next secure = not context == "login" if secure: appier.ensure("admin") scope = self.owner.admin_facebook_scope if secure else None url = self.ensure_facebook_api( state = state, scope = scope, refresh = secure ) if url: return self.redirect(url) return self.redirect( next or self.url_for(self.owner.admin_login_redirect) )
def google(self): next = self.field("next") context = self.field("context", "login") state = context + ":" + next secure = not context == "login" if secure: appier.ensure("admin") scope = self.owner.admin_google_scope if secure else None access_type = "offline" if secure else None approval_prompt = True if secure else False url = self.ensure_google_api( state = state, access_type = access_type, approval_prompt = approval_prompt, scope = scope, refresh = secure ) if url: return self.redirect(url) return self.redirect( next or self.url_for(self.owner.admin_login_redirect) )