Commit 739309c5 by swillison

example is now example_consumer. next= parameter now actually works (thanks Jesse Legg)

parent aef03dcd
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<title>Sign in with your OpenID</title> <title>Sign in with your OpenID</title>
<style type="text/css"> <style type="text/css">
input.openid { input.openid {
background: url({{ action }}?logo=1) no-repeat; background: url({{ logo }}) no-repeat;
background-position: 0 50%; background-position: 0 50%;
padding-left: 16px; padding-left: 16px;
} }
......
...@@ -3,7 +3,7 @@ from django.shortcuts import render_to_response as render ...@@ -3,7 +3,7 @@ from django.shortcuts import render_to_response as render
from django.template import RequestContext from django.template import RequestContext
from django.conf import settings from django.conf import settings
import md5, re, time import md5, re, time, urllib
from openid.consumer.consumer import Consumer, \ from openid.consumer.consumer import Consumer, \
SUCCESS, CANCEL, FAILURE, SETUP_NEEDED SUCCESS, CANCEL, FAILURE, SETUP_NEEDED
from openid.consumer.discover import DiscoveryFailure from openid.consumer.discover import DiscoveryFailure
...@@ -67,11 +67,22 @@ def begin(request, sreg=None, extension_args=None, redirect_to=None, ...@@ -67,11 +67,22 @@ def begin(request, sreg=None, extension_args=None, redirect_to=None,
join = '&' join = '&'
else: else:
join = '?' join = '?'
redirect_to += join + 'next=' + urllib.urlencode(request.GET['next']) redirect_to += join + urllib.urlencode({
'next': request.GET['next']
})
user_url = request.POST.get('openid_url', None) user_url = request.POST.get('openid_url', None)
if not user_url: if not user_url:
return render('openid_signin.html', {'action': request.path}) request_path = request.path
if request.GET.get('next'):
request_path += '?' + urllib.urlencode({
'next': request.GET['next']
})
return render('openid_signin.html', {
'action': request_path,
'logo': request.path + '?logo=1',
})
if xri.identifierScheme(user_url) == 'XRI' and getattr( if xri.identifierScheme(user_url) == 'XRI' and getattr(
settings, 'OPENID_DISALLOW_INAMES', False settings, 'OPENID_DISALLOW_INAMES', False
......
...@@ -63,7 +63,7 @@ MIDDLEWARE_CLASSES = ( ...@@ -63,7 +63,7 @@ MIDDLEWARE_CLASSES = (
'django_openidconsumer.middleware.OpenIDMiddleware', 'django_openidconsumer.middleware.OpenIDMiddleware',
) )
ROOT_URLCONF = 'example.urls' ROOT_URLCONF = 'example_consumer.urls'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
......
...@@ -10,4 +10,5 @@ urlpatterns = patterns('', ...@@ -10,4 +10,5 @@ urlpatterns = patterns('',
}), }),
(r'^openid/complete/$', 'django_openidconsumer.views.complete'), (r'^openid/complete/$', 'django_openidconsumer.views.complete'),
(r'^openid/signout/$', 'django_openidconsumer.views.signout'), (r'^openid/signout/$', 'django_openidconsumer.views.signout'),
(r'^next-works/$', views.next_works),
) )
...@@ -25,9 +25,14 @@ def index(request): ...@@ -25,9 +25,14 @@ def index(request):
s.append('<a href="/openid/">Sign in with OpenID</a>') s.append('<a href="/openid/">Sign in with OpenID</a>')
s.append(' | <a href="/openid/with-sreg/">') s.append(' | <a href="/openid/with-sreg/">')
s.append('Sign in with OpenID using simple registration</a>') s.append('Sign in with OpenID using simple registration</a>')
s.append(' | <a href="/openid/?next=/next-works/">')
s.append('Sign in with OpenID, testing ?next= param</a>')
if request.openid: if request.openid:
s.append(' | <a href="/openid/signout/">Sign out</a>') s.append(' | <a href="/openid/signout/">Sign out</a>')
s.append('</p>') s.append('</p>')
return HttpResponse('\n'.join(s)) return HttpResponse('\n'.join(s))
def next_works(request):
return HttpResponse('?next= bit works. <a href="/">Home</a>')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment