Anonymous avatar Anonymous committed 21bbeee

[svn r100] revert latest change to r97

Comments (0)

Files changed (2)

django_authopenid/views.py

 from django.utils.encoding import smart_unicode
 from django.utils.html import escape
 from django.utils.translation import ugettext as _
-from django.utils.functional import curry
 from django.contrib.sites.models import Site
 from django.utils.http import urlquote_plus
 from django.core.mail import send_mail
     redirect_url = auth_request.redirectURL(trust_root, redirect_to)
     return HttpResponseRedirect(redirect_url)
 
-def complete(request, on_success=None, on_failure=None, return_to=None,
-             success_template=None):
+def complete(request, on_success=None, on_failure=None, return_to=None):
     """ complete openid signin """
-    if on_success:
-        on_success = curry(on_success, success_template=success_template)
     on_success = on_success or default_on_success
-    
     on_failure = on_failure or default_on_failure
     
     consumer = Consumer(request.session, DjangoOpenIDStore())
     return decorated
 
 @not_authenticated
-def signin(request, openid_form=OpenidSigninForm, auth_form=OpenidAuthForm,
-           template='authopenid/signin.html'):
+def signin(request):
     """
     signin page. It manage the legacy authentification (user/password) 
     and authentification with openid.
 
     url: /signin/
     
-    template : authopenid/signin.html
+    template : authopenid/signin.htm
     """
 
     on_failure = signin_failure
     next = clean_next(request.GET.get('next'))
 
-    form_signin = openid_form(initial={'next':next})
-    form_auth = openid_form(initial={'next':next})
+    form_signin = OpenidSigninForm(initial={'next':next})
+    form_auth = OpenidAuthForm(initial={'next':next})
 
     if request.POST:   
         if 'bsignin' in request.POST.keys():
-            form_signin = openid_form(request.POST)
+            form_signin = OpenidSigninForm(request.POST)
             if form_signin.is_valid():
                 next = clean_next(form_signin.cleaned_data.get('next'))
                 sreg_req = sreg.SRegRequest(optional=['nickname', 'email'])
 
         elif 'blogin' in request.POST.keys():
             # perform normal django authentification
-            form_auth = auth_form(request.POST)
+            form_auth = OpenidAuthForm(request.POST)
             if form_auth.is_valid():
                 user_ = form_auth.get_user()
                 login(request, user_)
                 return HttpResponseRedirect(next)
 
 
-    return render(template, {
+    return render('authopenid/signin.html', {
         'form1': form_auth,
         'form2': form_signin,
         'msg':  request.GET.get('msg',''),
         'sendpw_url': reverse('user_sendpw'),
     }, context_instance=RequestContext(request))
 
-
-def complete_signin(request, template=None):
+def complete_signin(request):
     """ in case of complete signin with openid """
     return complete(request, signin_success, signin_failure,
-            get_url_host(request) + reverse('user_complete_signin'),
-            success_template=template)
+            get_url_host(request) + reverse('user_complete_signin'))
 
 
-def signin_success(request, identity_url, openid_response, success_template=None):
+def signin_success(request, identity_url, openid_response):
     """
     openid signin success.
 
         rel = UserAssociation.objects.get(openid_url__exact = str(openid_))
     except:
         # try to register this new user
-        return register(request, template=success_template)
+        return register(request)
     user_ = rel.user
     if user_.is_active:
         user_.backend = "django.contrib.auth.backends.ModelBackend"
     return is_exist
 
 @not_authenticated
-def register(request, template='authopenid/complete.html'):
+def register(request):
     """
     register an openid.
 
 
     template : authopenid/complete.html
     """
-    
+
     is_redirect = False
     next = clean_next(request.GET.get('next'))
     openid_ = request.session.get('openid', None)
         if is_redirect:
             return HttpResponseRedirect(next) 
     
-    return render(template, {
+    return render('authopenid/complete.html', {
         'form1': form1,
         'form2': form2,
         'nickname': nickname,
     ],
     packages = ['django_authopenid'],
     package_data = { 'django_authopenid': [ 'templates/*.*', 'templates/authopenid/*'] },
-    
+
     setup_requires = [
         'setuptools>=0.6b1',
         'python-openid'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.