Commits

Jannis Leidel committed 7681a0c

Added code to handle a non-redirect response by rendering the new template openid_provider/response.html with the prerendered response body.

Comments (0)

Files changed (2)

openid_provider/templates/openid_provider/response.html

+{% extends "openid_provider/base.html" %}
+
+{% block content %}
+{{ body }}
+{% endblock %}

openid_provider/views.py

         add_ax_data(request, orequest, oresponse)
     # Convert a webresponse from the OpenID library in to a Django HttpResponse
     webresponse = server.encodeResponse(oresponse)
-    response = HttpResponse(webresponse.body)
-    response.status_code = webresponse.code
-    for key, value in webresponse.headers.items():
-        response[key] = value
+    if webresponse.code == 200:
+        response = render_to_response('openid_provider/response.html', {
+            'body': webresponse.body,
+        }, context_instance=RequestContext(request))
+    else:
+        response = HttpResponse(webresponse.body)
+        response.status_code = webresponse.code
+        for key, value in webresponse.headers.items():
+            response[key] = value
     return response
 
 def openid_xrds(request, identity=False, id=None):