Browse Source

Merge branch 'master' into stable

* master:
  Pridan T.G. jako prijemce admin mailu
  Middleware for AJAX requests
remotes/origin/temata
Tomas Gavenciak 9 years ago
parent
commit
d392f1d52d
  1. 6
      mamweb/middleware.py
  2. 1
      mamweb/settings_prod.py
  3. 1
      mamweb/settings_test.py

6
mamweb/middleware.py

@ -40,7 +40,11 @@ class LoggedInHintCookieMiddleware(object):
def process_response(self, request, response): def process_response(self, request, response):
if request.is_secure(): if request.is_secure():
# assuming full session info (as the conn. is secure) # assuming full session info (as the conn. is secure)
if request.user.is_authenticated(): try:
user = request.user
except AttributeError: # no user - ajax or other special request
return response
if user.is_authenticated():
if not self.cookie_correct(request): if not self.cookie_correct(request):
expiry = None if request.session.get_expire_at_browser_close() else request.session.get_expiry_date() expiry = None if request.session.get_expire_at_browser_close() else request.session.get_expiry_date()
response.set_cookie(self.cookie_name, value=self.cookie_value, expires=expiry, secure=False) response.set_cookie(self.cookie_name, value=self.cookie_value, expires=expiry, secure=False)

1
mamweb/settings_prod.py

@ -48,6 +48,7 @@ import os
SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz' SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz'
ADMINS = [ ADMINS = [
('Petr Pecha', 'nejlepsitextovyeditorjevim@gmail.com'), ('Petr Pecha', 'nejlepsitextovyeditorjevim@gmail.com'),
('Tomas Gavenciak', 'gavento@gmail.com'),
('Matěj Kocián', 'matej.kocian@gmail.com'), ('Matěj Kocián', 'matej.kocian@gmail.com'),
] ]

1
mamweb/settings_test.py

@ -50,6 +50,7 @@ import os
SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz' SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz'
ADMINS = [ ADMINS = [
('Petr Pecha', 'nejlepsitextovyeditorjevim@gmail.com'), ('Petr Pecha', 'nejlepsitextovyeditorjevim@gmail.com'),
('Tomas Gavenciak', 'gavento@gmail.com'),
] ]

Loading…
Cancel
Save