当前位置: 首页>>代码示例>>Python>>正文


Python OpenID.get_redirect方法代码示例

本文整理汇总了Python中socialregistration.utils.OpenID.get_redirect方法的典型用法代码示例。如果您正苦于以下问题:Python OpenID.get_redirect方法的具体用法?Python OpenID.get_redirect怎么用?Python OpenID.get_redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在socialregistration.utils.OpenID的用法示例。


在下文中一共展示了OpenID.get_redirect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: openid_redirect

# 需要导入模块: from socialregistration.utils import OpenID [as 别名]
# 或者: from socialregistration.utils.OpenID import get_redirect [as 别名]
def openid_redirect(request):
    """
    Redirect the user to the openid provider
    """
    request.session["next"] = _get_next(request)
    request.session["openid_provider"] = request.GET.get("openid_provider")

    client = OpenID(
        request,
        "http%s://%s%s" % (_https(), Site.objects.get_current().domain, reverse("openid_callback")),
        request.GET.get("openid_provider"),
    )
    return client.get_redirect()
开发者ID:statico,项目名称:django-socialregistration,代码行数:15,代码来源:views.py

示例2: openid_redirect

# 需要导入模块: from socialregistration.utils import OpenID [as 别名]
# 或者: from socialregistration.utils.OpenID import get_redirect [as 别名]
def openid_redirect(request):
    """
    Redirect the user to the openid provider
    """
    request.session['next'] = _get_next(request)
    request.session['openid_provider'] = request.GET.get('openid_provider')
    request.session['socialregistration_connect_object'] = get_object(request.GET)

    client = OpenID(
        request,
        'http%s://%s%s' % (
            _https(),
            Site.objects.get_current().domain,
            reverse('openid_callback')
        ),
        request.GET.get('openid_provider')
    )
    try:
        logger.info("Received redirect to %s from OpenID" % client.get_redirect())
        return client.get_redirect()
    except DiscoveryFailure:
        request.session['openid_error'] = True
        logger.info("OpenID failure, sending user to login.")
        return HttpResponseRedirect(settings.LOGIN_URL)
开发者ID:adamfast,项目名称:django-socialregistration,代码行数:26,代码来源:views.py

示例3: openid_redirect

# 需要导入模块: from socialregistration.utils import OpenID [as 别名]
# 或者: from socialregistration.utils.OpenID import get_redirect [as 别名]
def openid_redirect(request):
    """
    Redirect the user to the openid provider
    """
    request.session['next'] = _get_next(request)
    request.session['openid_provider'] = request.GET.get('openid_provider')
    
    client = OpenID(
        request,
        'http://%s%s' % (
            Site.objects.get_current().domain,
            reverse('openid_callback')
        ),
        request.GET.get('openid_provider')
    )
    return client.get_redirect()
开发者ID:timjdavey,项目名称:django-socialregistration,代码行数:18,代码来源:views.py

示例4: openid_redirect

# 需要导入模块: from socialregistration.utils import OpenID [as 别名]
# 或者: from socialregistration.utils.OpenID import get_redirect [as 别名]
def openid_redirect(request):
    """
    Redirect the user to the openid provider
    """
    request.session["next"] = _get_next(request)
    request.session["openid_provider"] = request.GET.get("openid_provider")
    client = OpenID(
        request,
        "http%s://%s%s" % (_https(), request.get_host(), reverse("openid_callback")),
        request.GET.get("openid_provider"),
    )
    try:
        return client.get_redirect()
    except DiscoveryFailure:
        request.session["openid_error"] = True
        return HttpResponseRedirect(settings.LOGIN_URL)
开发者ID:oduvan,项目名称:django-socialregistration,代码行数:18,代码来源:views.py

示例5: openid_redirect

# 需要导入模块: from socialregistration.utils import OpenID [as 别名]
# 或者: from socialregistration.utils.OpenID import get_redirect [as 别名]
def openid_redirect(request):
    """
    Redirect the user to the openid provider
    """
    request.session['next'] = _get_next(request)
    request.session['openid_provider'] = request.GET.get('openid_provider')

    client = OpenID(
        request,
        _callback_url(request),
        request.GET.get('openid_provider')
    )
    try:
        return client.get_redirect()
    except DiscoveryFailure:
        request.session['openid_error'] = True
        return HttpResponseRedirect(settings.LOGIN_URL)
开发者ID:leopd,项目名称:django-socialregistration,代码行数:19,代码来源:views.py

示例6: openid_redirect

# 需要导入模块: from socialregistration.utils import OpenID [as 别名]
# 或者: from socialregistration.utils.OpenID import get_redirect [as 别名]
def openid_redirect(request):
    """
    Redirect the user to the openid provider
    """
    request.session['next'] = _get_next(request)
    request.session['openid_provider'] = request.GET.get('openid_provider')

    client = OpenID(
        request,
        'http%s://%s%s' % (
            _https(),
            Site.objects.get_current().domain,
            reverse('openid_callback')
        ),
        request.GET.get('openid_provider')
    )
    try:
        return client.get_redirect()
    except DiscoveryFailure:
        request.session['openid_error'] = True
        return HttpResponseRedirect(settings.LOGIN_URL)
开发者ID:JordanReiter,项目名称:django-socialregistration,代码行数:23,代码来源:views.py

示例7: openid_redirect

# 需要导入模块: from socialregistration.utils import OpenID [as 别名]
# 或者: from socialregistration.utils.OpenID import get_redirect [as 别名]
def openid_redirect(request):
    """
    Redirect the user to the openid provider
    """
    request.session['next'] = _get_next(request)
    request.session['openid_provider'] = request.GET.get('openid_provider')

    provider = request.GET.get('openid_provider')
    client = OpenID(
        request,
        _openid_callback_url(),
        provider
    )
    try:
        return client.get_redirect()
    except DiscoveryFailure:
        return render_to_response(
            'socialregistration/provider_failure.html',
            dict(provider=provider),
            context_instance=RequestContext(request)
        )
开发者ID:dasmith2,项目名称:django-socialregistration,代码行数:23,代码来源:views.py


注:本文中的socialregistration.utils.OpenID.get_redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。