def openid_start(request): openid_url = "https://www.google.com/accounts/o8/id" store = FileOpenIDStore(settings.OPENID_STORE) consumer = Consumer(request.session, store) auth_request = consumer.begin(openid_url) # XXX: production. Handle errors! auth_request.addExtension(makeOpenIDAXRequest()) auth_request.addExtension(OpenIDUIExtension(mode="popup", icon=False)) url = auth_request.redirectURL(request.build_absolute_uri("/"), request.build_absolute_uri(reverse("openid_done"))) return HttpResponseRedirect(url)
def marketplace_login(request): google_domain = request.GET.get("domain") if not google_domain: return redirect("index") openid_url = "https://www.google.com/accounts/o8/site-xrds?hd=%s" % quote(google_domain) store = FileOpenIDStore(settings.OPENID_STORE) consumer = Consumer(request.session, store) auth_request = consumer.begin(openid_url) # XXX: production. Handle errors! auth_request.addExtension(makeOpenIDAXRequest()) url = auth_request.redirectURL( request.build_absolute_uri("/")[:-1], # remove trailing slash request.build_absolute_uri(reverse("marketplace_done")), ) return HttpResponseRedirect(url)