Example #1
0
def new_association(request):
    detail = request.session.get("authentication_user_detail")
    provider = detail["social_provider"]
    strategy = get_strategy(provider)
    _new_association(strategy, detail, request.user)
    provider_platform = PROVIDER_MAPPER.get(provider, {}).get("platform", u"三方")
    context = {"provider": provider_platform}
    return render_to_response("oauth/oauth_bind_success.html", context)
def new_association(request):
    detail = request.session.get('authentication_user_detail')
    provider = detail['social_provider']
    strategy = get_strategy(provider)
    _new_association(strategy, detail, request.user)
    provider_platform = PROVIDER_MAPPER.get(provider, {}).get('platform', u'三方')
    context = {'provider': provider_platform}
    return render_to_response('xuetangx/oauth/oauth_bind_success.html', context)
Example #3
0
def new_association(request):
    detail = request.session.get('authentication_user_detail')
    provider = detail['social_provider']
    strategy = get_strategy(provider)
    _new_association(strategy, detail, request.user)
    provider_platform = PROVIDER_MAPPER.get(provider,
                                            {}).get('platform', u'三方')
    context = {'provider': provider_platform}
    return render_to_response('xuetangx/oauth/oauth_bind_success.html',
                              context)
 def handler_AuthAlreadyAssociated(self, request, exception):
     context = {}
     provider = PROVIDER_MAPPER.get(exception.backend.name, {}).get('platform', u'三方')
     msg = u'{provider}账号绑定失败'.format(provider=provider)
     reason = u'此{provider}账号已绑定过其他学堂账号,或者此学堂账号已经绑定过其他{provider}账号'.format(provider=provider)
     context['failed_title'] = msg
     context['failed_content'] = reason
     track_log(request, 'oauth.user.login_failure', {
         'success': False,
         'field': 'duplicate.{}'.format(provider),
         'context': context,
     })
     return render_to_response('xuetangx/oauth/failed.html', context)
 def handler_AuthException(self, request, exception):
     context = {}
     msg = u'账号登陆失败'
     long_message = u'登陆失败,请稍后重试'
     context['failed_title'] = msg
     context['failed_content'] = long_message
     context['retry_url'] = '/dashboard'
     context['retry_content'] = u'使用邮箱密码登陆'
     provider = PROVIDER_MAPPER.get(exception.backend.name, {}).get('platform', u'三方')
     track_log(request, 'oauth.user.login_failure', {
         'success': False,
         'field': 'incorrect.{}'.format(provider),
         'context': context,
     })
     return render_to_response('xuetangx/oauth/failed.html', context)