Changeset 8712 for mauRepo


Ignore:
Timestamp:
13/12/12 13:07:05 (7 years ago)
Author:
mnagni
Message:

corrects the previous (wrong) workflow

Location:
mauRepo/dj_security/trunk/dj_security
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/dj_security/trunk/dj_security/middleware.py

    r8711 r8712  
    6969            request.session['r'] = request.GET.get('r') 
    7070 
    71         if '/complete/' not in request.path: 
    72             request.session['done'] = False 
    73             return response 
    74  
    75         if request.path == '/account/signin/complete/' \ 
    76                 and not request.session.get('done', False): 
     71        if request.path.endswith('account/register/'): 
    7772            return _encode_authenticated_response(request, response) 
    78  
    79         #if request.path == '/account/signin/complete/' \ 
    80         # and request.session.get('done', False): 
    81         #    return response 
    8273         
    8374        return response 
     
    115106        raise DSJOpenIDNotFoundError(ex)   
    116107 
    117 def _encode_authenticated_response(request, response, context = {}): 
    118     remote_ip = calculate_remote_ip(base64.b64decode(request.session.get('r'))) 
     108def _encode_authenticated_response(request, response): 
     109    remote_ip = _calculate_remote_ip(base64.b64decode(request.session.get('r'))) 
    119110    LOGGER.info("responding to remote_ip: %s" % (remote_ip))  
    120111    username = request.session.get('openid').openid 
     
    132123    LOGGER.debug("Set authTicket in response for %s from %s"  
    133124                 % (username, remote_ip)) 
    134     redirect_parameter = getattr(settings, 'REDIRECT_URL', 'r') 
    135     context['redirect_url'] = \ 
    136         base64.b64decode(request.session.get(redirect_parameter, '')) 
    137     return render_to_response('logged_in.html', context) 
     125    return response 
  • mauRepo/dj_security/trunk/dj_security/urls.py

    r8711 r8712  
    1616    # url(r'^admin/', include(admin.site.urls)), 
    1717    #url(r'^accounts/', include('registration.backends.default.urls')), 
    18     url(r'^account/', include('django_authopenid.urls')), 
    1918) 
    2019 
     20urlpatterns += patterns('dj_security.views.dj_security_login', 
     21   (r'^account/register/$', 'logged_in'), 
     22   url(r'^account/', include('django_authopenid.urls')) 
     23) 
    2124 
    2225#urlpatterns += patterns('dj_security.views.dj_security_login', 
     
    2427#) 
    2528 
    26 #urlpatterns += patterns('dj_security.views.my_profile', 
    27 #    (r'^account/register/$', 'frontpage'), 
    28 #) 
     29#url(r'^register/$', oid_views.register, name='user_register'), 
     30 
    2931#urlpatterns += patterns('dj_security.views.my_profile', 
    3032#    (r'^account/signin/$', 'frontpage'), 
  • mauRepo/dj_security/trunk/dj_security/views/dj_security_login.py

    r8688 r8712  
    66from django.contrib.auth import authenticate 
    77from django.shortcuts import render_to_response 
    8 from dj_security.login_form import LoginForm 
    98from django.core.context_processors import csrf 
    109from django.conf import settings 
     10 
    1111import logging 
     12import base64 
     13 
     14from dj_security.login_form import LoginForm 
    1215from dj_security.encoder import SecurityEncoder 
    1316 
     
    6871        context.update(csrf(request)) 
    6972        return render_to_response('login.html', context) 
     73 
     74def logged_in(request): 
     75    return _encode_authenticated_response(request, context = {})     
    7076     
    7177def _encode_authenticated_response(request, context): 
    7278    redirect_parameter = getattr(settings, 'REDIRECT_URL', 'r') 
    73     context['redirect_url'] = request.GET.get(redirect_parameter, '') 
     79    context['redirect_url'] = \ 
     80        base64.b64decode(request.session.get(redirect_parameter, ''))     
    7481    return render_to_response('logged_in.html', context) 
Note: See TracChangeset for help on using the changeset viewer.