Пример #1
0
def done(request):
    return common_context(
        request.registry.settings['SOCIAL_AUTH_AUTHENTICATION_BACKENDS'],
        load_strategy(request),
        user=get_user(request),
        plus_id=request.registry.settings['SOCIAL_AUTH_GOOGLE_PLUS_KEY'],
    )
Пример #2
0
 def render_home(self, **extra):
     context = common_context(
         web.config[setting_name('AUTHENTICATION_BACKENDS')],
         load_strategy(),
         user=self.get_current_user(),
         plus_id=web.config.get(setting_name('SOCIAL_AUTH_GOOGLE_PLUS_KEY')),
         **extra
     )
     return render.home(**context)
Пример #3
0
 def render_home(self):
     context = common_context(
         cherrypy.config[setting_name('AUTHENTICATION_BACKENDS')],
         load_strategy(),
         user=getattr(cherrypy.request, 'user', None),
         plus_id=cherrypy.config.get(
             setting_name('SOCIAL_AUTH_GOOGLE_PLUS_KEY')))
     return cherrypy.tools.jinja2env \
                          .get_template("home.html") \
                          .render(**context)
Пример #4
0
def email_required(request):
    strategy = load_strategy(request)
    partial_token = request.GET.get('partial_token')
    partial = strategy.partial_load(partial_token)
    return common_context(
        request.registry.settings['SOCIAL_AUTH_AUTHENTICATION_BACKENDS'],
        strategy,
        user=get_user(request),
        plus_id=request.registry.settings['SOCIAL_AUTH_GOOGLE_PLUS_KEY'],
        email_required=True,
        partial_backend_name=partial.backend,
        partial_token=partial_token)
Пример #5
0
 def wrapper(request, *args, **kwargs):
     """Rendering method"""
     out = func(request, *args, **kwargs) or {}
     if isinstance(out, dict):
         out = render(request, template, common_context(
             settings.AUTHENTICATION_BACKENDS,
             load_strategy(),
             request.user,
             plus_id=getattr(settings, 'SOCIAL_AUTH_GOOGLE_PLUS_KEY', None),
             **out
         ))
     return out
Пример #6
0
    def render_home(self, **extra):
        from models import User

        user_id = self.get_secure_cookie('user_id')

        if user_id:
            user = session.query(User).get(int(user_id))
        else:
            user = None

        context = common_context(settings.SOCIAL_AUTH_AUTHENTICATION_BACKENDS,
                                 load_strategy(self),
                                 user=user,
                                 plus_id=getattr(
                                     settings, 'SOCIAL_AUTH_GOOGLE_PLUS_KEY',
                                     None),
                                 **extra)
        self.render('home.html', **context)
Пример #7
0
def load_common_context():
    return common_context(app.config['SOCIAL_AUTH_AUTHENTICATION_BACKENDS'],
                          load_strategy(), getattr(g, 'user', None),
                          app.config.get('SOCIAL_AUTH_GOOGLE_PLUS_KEY'))