def login():
    connections = dict()
    for socialsite in socialsites.list_sites():
        provider = import_oauth_class(socialsite)()
        connections[provider.site_name] = provider
    
    return render_template('login.html', connections=connections)
Ejemplo n.º 2
0
 def _social_sites():
     def make_site(s):
         s = import_oauth_class(s)()
         return {
             'site_id': s.site_id,
             'site_name': s.site_name,
             'site_name_zh': s.site_name_zh,
             'authorize_url': s.authorize_url,
         }
     return [make_site(s) for s in socialsites.list_sites()]
Ejemplo n.º 3
0
def login():
    def _link(s):
        m = import_oauth_class(s)
        _s = m()
        return """<div style="margin: 20px;">
        <a href="%s"><img src="/static/images/%s.png" /></a>
        </div>""" % (_s.authorize_url, _s.site_name)
    
    links = map(_link, socialsites.list_sites())
    links = '\n'.join(links)
    
    
    html = """<!DOCTYPE html>
    <html>
        <body>%s</body>
    </html>
    """ % links
    
    return html
Ejemplo n.º 4
0
def login():
    def _link(s):
        _s = import_oauth_class(s)()
        if os.path.exists(os.path.join(IMAGE_PATH, _s.site_name + '.png')):
            a_content = '<img src="/static/images/%s.png" />' % _s.site_name
        else:
            a_content = '使用 %s 登录' % _s.site_name_zh

        return """<div style="margin: 20px;">
        <a href="%s">%s</a>
        </div>""" % (_s.authorize_url, a_content)

    links = map(_link, socialsites.list_sites())
    links = '\n'.join(links)

    html = """<!DOCTYPE html>
    <html>
        <body>%s</body>
    </html>
    """ % links

    return html
Ejemplo n.º 5
0
def login():
    def _link(s):
        _s = import_oauth_class(s)()
        if os.path.exists(os.path.join(IMAGE_PATH, _s.site_name + '.png')):
            a_content = '<img src="/static/images/%s.png" />' % _s.site_name
        else:
            a_content = '使用 %s 登录' % _s.site_name_zh
        
        return """<div style="margin: 20px;">
        <a href="%s">%s</a>
        </div>""" % (_s.authorize_url, a_content)
    
    links = map(_link, socialsites.list_sites())
    links = '\n'.join(links)
    
    
    html = """<!DOCTYPE html>
    <html>
        <body>%s</body>
    </html>
    """ % links
    
    return html