Ejemplo n.º 1
0
def signin_success(request, identity_url, openid_response):
    """
    this is not a view, has no url pointing to this

    this function is called when OpenID provider returns
    successful response to user authentication

    Does actual authentication in Django site and
    redirects to the registration page, if necessary
    or adds another login method.
    """

    logging.debug("")
    openid_data = util.from_openid_response(openid_response)  # create janrain OpenID object
    request.session["openid"] = openid_data

    provider_name = util.get_openid_provider_name(openid_data.openid)
    user = authenticate(identifier=openid_data.openid, provider_name=provider_name, method="openid")

    next_url = get_next_url(request)

    request.session["email"] = openid_data.sreg.get("email", "")
    request.session["username"] = openid_data.sreg.get("nickname", "")

    return finalize_generic_signin(
        request=request,
        user=user,
        user_identifier=openid_data.openid,
        login_provider_name=provider_name,
        redirect_url=next_url,
    )
Ejemplo n.º 2
0
def signin_success(request, identity_url, openid_response):
    """
    this is not a view, has no url pointing to this

    this function is called when OpenID provider returns
    successful response to user authentication

    Does actual authentication in Django site and
    redirects to the registration page, if necessary
    or adds another login method.
    """

    logging.debug('')
    openid_data = util.from_openid_response(
        openid_response)  #create janrain OpenID object
    request.session['openid'] = openid_data

    provider_name = util.get_openid_provider_name(openid_data.openid)
    user = authenticate(identifier=openid_data.openid,
                        provider_name=provider_name,
                        method='openid')

    next_url = get_next_url(request)

    request.session['email'] = openid_data.sreg.get('email', '')
    request.session['username'] = openid_data.sreg.get('nickname', '')

    return finalize_generic_signin(request=request,
                                   user=user,
                                   user_identifier=openid_data.openid,
                                   login_provider_name=provider_name,
                                   redirect_url=next_url)
    def forwards(self, orm):
        "determines openid provider from url"

        from django_authenticator.util import migration_was_applied
        if migration_was_applied(__file__, 'django_authopenid'):
            return

        for assoc in orm['django_authopenid.UserAssociation'].objects.all():
            assoc.provider_name = util.get_openid_provider_name(assoc.openid_url)
            print '%s -> %s' % (assoc.user.username, assoc.provider_name)
            assoc.save()
    def forwards(self, orm):
        "determines openid provider from url"

        from django_authenticator.util import migration_was_applied
        if migration_was_applied(__file__, 'django_authopenid'):
            return

        for assoc in orm['django_authopenid.UserAssociation'].objects.all():
            assoc.provider_name = util.get_openid_provider_name(
                assoc.openid_url)
            print '%s -> %s' % (assoc.user.username, assoc.provider_name)
            assoc.save()