0001-misc-coding-style.patch
src/authentic2/middleware.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU Affero General Public License |
15 | 15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
import random |
|
18 |
import struct |
|
19 | 17 |
import time |
20 | 18 |
try: |
21 | 19 |
import threading |
22 | 20 |
except ImportError: |
23 | 21 |
threading = None |
24 | 22 | |
25 |
from binascii import hexlify |
|
26 | 23 |
from django.conf import settings |
27 | 24 |
from django.contrib import messages |
28 | 25 |
from django.utils.deprecation import MiddlewareMixin |
29 |
from django.utils.encoding import force_text |
|
30 | 26 |
from django.utils.functional import SimpleLazyObject |
31 | 27 |
from django.utils.translation import ugettext as _ |
32 | 28 |
from django.utils.six.moves.urllib import parse as urlparse |
... | ... | |
65 | 61 |
domain = app_settings.A2_OPENED_SESSION_COOKIE_DOMAIN |
66 | 62 |
if hasattr(request, 'user') and request.user.is_authenticated: |
67 | 63 |
response.set_cookie(name, value='1', max_age=None, domain=domain, |
68 |
secure=app_settings.A2_OPENED_SESSION_COOKIE_SECURE) |
|
64 |
secure=app_settings.A2_OPENED_SESSION_COOKIE_SECURE)
|
|
69 | 65 |
elif app_settings.A2_OPENED_SESSION_COOKIE_NAME in request.COOKIES: |
70 | 66 |
response.delete_cookie(name, domain=domain) |
71 | 67 |
return response |
72 |
- |