comparison src/server/server.py @ 706:fe03637fe5a6

server_side: add a link to the FAQ in the HTTP/HTTPS warning dialog
author souliane <souliane@mailoo.org>
date Fri, 05 Jun 2015 21:16:45 +0200
parents 531eacb82e9f
children dfe4b0291daa
comparison
equal deleted inserted replaced
705:531eacb82e9f 706:fe03637fe5a6
848 848
849 def __getSecurityWarning(self): 849 def __getSecurityWarning(self):
850 """@return: a security warning message, or None if the connection is secure""" 850 """@return: a security warning message, or None if the connection is secure"""
851 if self.request.URLPath().scheme == 'https' or not self.sat_host.security_warning: 851 if self.request.URLPath().scheme == 'https' or not self.sat_host.security_warning:
852 return None 852 return None
853 text = D_("You are about to connect to an unsecured service.") 853 text = D_("You are about to connect to an unsecure service.")
854 if self.sat_host.connection_type == 'both': 854 if self.sat_host.connection_type == 'both':
855 new_port = (':%s' % self.sat_host.port_https_ext) if self.sat_host.port_https_ext != HTTPS_PORT else '' 855 new_port = (':%s' % self.sat_host.port_https_ext) if self.sat_host.port_https_ext != HTTPS_PORT else ''
856 url = "https://%s" % self.request.URLPath().netloc.replace(':%s' % self.sat_host.port, new_port) 856 url = "https://%s" % self.request.URLPath().netloc.replace(':%s' % self.sat_host.port, new_port)
857 text += D_('<br />Secure version of this website: <a href="%(url)s">%(url)s</a>') % {'url': url} 857 text += D_('<br />Please read our %(faq_prefix)ssecurity notice%(faq_suffix)s regarding HTTPS') % {'faq_prefix': '<a href="http://salut-a-toi.org/faq.html#https" target="#">', 'faq_suffix': '</a>'}
858 text += D_('<br />and use the secure version of this website:<br /><a href="%(url)s" target="#">%(url)s</a>') % {'url': url}
859 else:
860 text += D_('You should ask the administrator of %(url)s to turn on HTTPS.')
858 return text 861 return text
859 862
860 863
861 class SignalHandler(jsonrpc.JSONRPC): 864 class SignalHandler(jsonrpc.JSONRPC):
862 865