Beispiel #1
0
def init_for(env):
    coaster.app.init_app(app, env)
    db.init_app(app)
    db.app = app  # To make it work without an app context
    RQ(app)  # Pick up RQ configuration from the app
    baseframe.init_app(app, requires=['lastuser-oauth'],
        ext_requires=['baseframe-bs3', 'fontawesome>=4.0.0', 'jquery.cookie', 'timezone'])

    lastuser_oauth.mailclient.mail.init_app(app)
    lastuser_oauth.views.login.oid.init_app(app)

    # Register some login providers
    if app.config.get('OAUTH_TWITTER_KEY') and app.config.get('OAUTH_TWITTER_SECRET'):
        login_registry['twitter'] = providers.TwitterProvider('twitter', 'Twitter',
            at_login=True, priority=True,
            key=app.config['OAUTH_TWITTER_KEY'],
            secret=app.config['OAUTH_TWITTER_SECRET'],
            access_key=app.config.get('OAUTH_TWITTER_ACCESS_KEY'),
            access_secret=app.config.get('OAUTH_TWITTER_ACCESS_SECRET'))
    login_registry['google'] = providers.GoogleProvider('google', 'Google',
        at_login=True, priority=True)
    if app.config.get('OAUTH_LINKEDIN_KEY') and app.config.get('OAUTH_LINKEDIN_SECRET'):
        login_registry['linkedin'] = providers.LinkedInProvider('linkedin', 'LinkedIn',
            at_login=True, priority=False,
            key=app.config['OAUTH_LINKEDIN_KEY'],
            secret=app.config['OAUTH_LINKEDIN_SECRET'])
    if app.config.get('OAUTH_GITHUB_KEY') and app.config.get('OAUTH_GITHUB_SECRET'):
        login_registry['github'] = providers.GitHubProvider('github', 'GitHub',
            at_login=True, priority=False,
            key=app.config['OAUTH_GITHUB_KEY'],
            secret=app.config['OAUTH_GITHUB_SECRET'])
    login_registry['openid'] = providers.OpenIdProvider('openid', 'OpenID',
        at_login=True, priority=False)
Beispiel #2
0
        secret=app.config['OAUTH_GOOGLE_SECRET'],
        scope=app.config.get('OAUTH_GOOGLE_SCOPE', ['email', 'profile']),
        at_login=True,
        priority=True,
        icon='google')
if app.config.get('OAUTH_LINKEDIN_KEY') and app.config.get(
        'OAUTH_LINKEDIN_SECRET'):
    login_registry['linkedin'] = providers.LinkedInProvider(
        'linkedin',
        'LinkedIn',
        at_login=True,
        priority=False,
        icon='linkedin',
        key=app.config['OAUTH_LINKEDIN_KEY'],
        secret=app.config['OAUTH_LINKEDIN_SECRET'])
if app.config.get('OAUTH_GITHUB_KEY') and app.config.get(
        'OAUTH_GITHUB_SECRET'):
    login_registry['github'] = providers.GitHubProvider(
        'github',
        'GitHub',
        at_login=True,
        priority=False,
        icon='github',
        key=app.config['OAUTH_GITHUB_KEY'],
        secret=app.config['OAUTH_GITHUB_SECRET'])
login_registry['openid'] = providers.OpenIdProvider('openid',
                                                    'OpenID',
                                                    at_login=True,
                                                    priority=False,
                                                    icon='openid')