Revision 603284d4

b/htdocs/site_media/js/check-cookie.js
1 1
$(document).ready(function(){
2
    if ($.cookie("X-Auth-Token") || $.cookie("_pithos2_a")) {
2
    if ($.cookie("_pithos2_a")) {
3 3
        $("body").addClass("auth");
4 4
    }
5 5
});
b/pithos/middleware/auth.py
60 60
                    request.set_auth_cookie = True
61 61
                user = get_user_from_token(token)
62 62
            if not user:
63
                user = get_user_from_token(request.COOKIES.get('X-Auth-Token'))
63
                cookie_value = request.COOKIES.get('_pithos2_a')
64
                if cookie_value and '|' in cookie_value:
65
                    token = cookie_value.split('|', 1)[1]
66
                    user = get_user_from_token(token)
64 67
        if not user:
65 68
            return
66 69
        
......
78 81
    def process_response(self, request, response):
79 82
        if getattr(request, 'user', None) and getattr(request, 'set_auth_cookie', False):
80 83
            expire_fmt = request.user.auth_token_expires.strftime('%a, %d-%b-%Y %H:%M:%S %Z')
81
            response.set_cookie('X-Auth-Token', value=request.user.auth_token, expires=expire_fmt, path='/')
84
            cookie_value = request.user.uniq + '|' + request.user.auth_token
85
            response.set_cookie('_pithos2_a', value=cookie_value, expires=expire_fmt, path='/')
82 86
        return response

Also available in: Unified diff