本文整理汇总了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()
示例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)
示例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()
示例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)
示例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)
示例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)
示例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)
)