Ignore:
Timestamp:
06/11/12 09:05:35 (7 years ago)
Author:
mnagni
Message:

Small refactoring and fix the name of context_processor module

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/dj_security/trunk/dj_security/views/my_profile.py

    r8652 r8665  
    99from paste.auth.auth_tkt import BadTicket 
    1010from paste.auth import auth_tkt 
     11from django.conf import settings 
    1112 
    1213def get_user_profile(request): 
     
    2526    context = {} 
    2627    if request.COOKIES.has_key('auth_tkt'): 
    27         try: 
    28             timestamp, userid, tokens, user_data = auth_tkt.parse_ticket( 
    29                     'sharedsecret', request.COOKIES['auth_tkt'], '127.0.0.1') 
     28        try:   
     29            timestamp, userid, tokens, user_data = \ 
     30                auth_tkt.parse_ticket( 
     31                        getattr(settings, 'SHARED_SECRET', 'sharedsecret'),  
     32                        request.COOKIES['auth_tkt'],  
     33                        request.META['REMOTE_ADDR']) 
    3034 
     35            context['timestamp'] = timestamp 
    3136            context['username'] = userid 
     37            context['tokens'] = tokens                         
     38            context['user_data'] = user_data 
    3239            return render_to_response('logged_in.html', context) 
    33         except BadTicket as ex: 
     40        except BadTicket: 
    3441            pass 
    3542         
Note: See TracChangeset for help on using the changeset viewer.