Changeset 8652


Ignore:
Timestamp:
02/11/12 14:00:35 (7 years ago)
Author:
mnagni
Message:

links some more bits

File:
1 edited

Legend:

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

    r8650 r8652  
    44@author: mnagni 
    55''' 
    6 from django.http import HttpResponseRedirect 
    7 from django.db.utils import IntegrityError 
    86from dj_security.views.my_view import errorHandle 
    97from dj_security.models import UserProfile 
     8from django.shortcuts import render_to_response 
     9from paste.auth.auth_tkt import BadTicket 
     10from paste.auth import auth_tkt 
    1011 
    1112def get_user_profile(request): 
     
    2324def frontpage(request): 
    2425    context = {} 
    25     # just some auth stuff. it's probably nicer to handle this elsewhere 
    26     # (use decorator or some other solution :) ) 
    27     if not request.user.is_authenticated(): 
    28         return HttpResponseRedirect('/login/') 
     26    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') 
    2930 
    30     try: 
    31         user_profile = get_user_profile(request) 
    32     except IntegrityError as error: 
    33         context['error'] = error 
    34         return errorHandle(request, context) 
    35  
    36     ''' 
    37     if user_profile.first_log_in: 
    38         user_profile.first_log_in = False 
    39         user_profile.save() 
    40         return HttpResponseRedirect('/profile/') 
    41     ''' 
    42  
    43     return HttpResponseRedirect('/frontpage') 
     31            context['username'] = userid 
     32            return render_to_response('logged_in.html', context) 
     33        except BadTicket as ex: 
     34            pass 
     35         
     36    return errorHandle(request, context) 
Note: See TracChangeset for help on using the changeset viewer.