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.translation import ugettext as _ |
31 | 27 |
from django.utils.six.moves.urllib import parse as urlparse |
32 |
from django.shortcuts import render |
|
33 | 28 | |
34 | 29 |
from . import app_settings, utils, plugins |
35 | 30 |
from .utils.service import get_service_from_request |
... | ... | |
64 | 59 |
domain = app_settings.A2_OPENED_SESSION_COOKIE_DOMAIN |
65 | 60 |
if hasattr(request, 'user') and request.user.is_authenticated: |
66 | 61 |
response.set_cookie(name, value='1', max_age=None, domain=domain, |
67 |
secure=app_settings.A2_OPENED_SESSION_COOKIE_SECURE) |
|
62 |
secure=app_settings.A2_OPENED_SESSION_COOKIE_SECURE)
|
|
68 | 63 |
elif app_settings.A2_OPENED_SESSION_COOKIE_NAME in request.COOKIES: |
69 | 64 |
response.delete_cookie(name, domain=domain) |
70 | 65 |
return response |
71 |
- |