Example #1
0
def binds(user):
    details = []
    for d in ACCOUNT_DETAILS:
        d['account'] = account_with_kind(d['kind'])
        d['static'] = static_with_kind(d['kind']) if binded_account(user, d['kind']) else static_unbind_with_kind(d['kind'])
        d['url'] = eval(d['account']).url()
        details.append(d)
    for d in UNAUTHENTICATED_ACCOUNT_DETAILS:
        d['static'] = static_with_kind(d['kind'])
        details.append(d)
    return details
Example #2
0
def binded_account(user, kind, require_password=False):
    name = account_with_kind(kind)
    if name in UNAUTHENTICATED_ACCOUNT_NAMES: return True
    name = name.lower()
    return hasattr(user, name) and getattr(user, name).password if require_password else hasattr(user, name)