Esempio n. 1
0
def get_bk_login_ticket(request):
    form_cls = 'AuthenticationForm'
    context = [request.COOKIES, request.GET]

    if request.is_rio():
        form_cls = 'RioAuthenticationForm'
        context.insert(0, request.META)

    elif request.is_wechat():
        form_cls = 'WeixinAuthenticationForm'

    AuthenticationForm = load_backend("forms.{}".format(form_cls))

    for form in (AuthenticationForm(c) for c in context):
        if form.is_valid():
            return form.cleaned_data

    return {}
Esempio n. 2
0
# -*- coding: utf-8 -*-
from blueapps.account.conf import ConfFixture
from blueapps.account.utils import load_backend

if hasattr(ConfFixture, 'USER_BACKEND'):
    UserBackend = load_backend(ConfFixture.USER_BACKEND)

if hasattr(ConfFixture, 'WEIXIN_BACKEND'):
    WeixinBackend = load_backend(ConfFixture.WEIXIN_BACKEND)

if hasattr(ConfFixture, 'RIO_BACKEND'):
    RioBackend = load_backend(ConfFixture.RIO_BACKEND)
Esempio n. 3
0
def get_user_model():
    """
    返回平台对应版本 User Proxy Model
    """
    return load_backend(ConfFixture.USER_MODEL)