Commit 739309c5 by swillison

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

parent aef03dcd
......@@ -5,7 +5,7 @@
<title>Sign in with your OpenID</title>
<style type="text/css">
input.openid {
background: url({{ action }}?logo=1) no-repeat;
background: url({{ logo }}) no-repeat;
background-position: 0 50%;
padding-left: 16px;
}
......
......@@ -3,7 +3,7 @@ from django.shortcuts import render_to_response as render
from django.template import RequestContext
from django.conf import settings
import md5, re, time
import md5, re, time, urllib
from openid.consumer.consumer import Consumer, \
SUCCESS, CANCEL, FAILURE, SETUP_NEEDED
from openid.consumer.discover import DiscoveryFailure
......@@ -67,11 +67,22 @@ def begin(request, sreg=None, extension_args=None, redirect_to=None,
join = '&'
else:
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)
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(
settings, 'OPENID_DISALLOW_INAMES', False
......
......@@ -63,7 +63,7 @@ MIDDLEWARE_CLASSES = (
'django_openidconsumer.middleware.OpenIDMiddleware',
)
ROOT_URLCONF = 'example.urls'
ROOT_URLCONF = 'example_consumer.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
......
......@@ -10,4 +10,5 @@ urlpatterns = patterns('',
}),
(r'^openid/complete/$', 'django_openidconsumer.views.complete'),
(r'^openid/signout/$', 'django_openidconsumer.views.signout'),
(r'^next-works/$', views.next_works),
)
......@@ -25,9 +25,14 @@ def index(request):
s.append('<a href="/openid/">Sign in with OpenID</a>')
s.append(' | <a href="/openid/with-sreg/">')
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:
s.append(' | <a href="/openid/signout/">Sign out</a>')
s.append('</p>')
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