def render(self, context): url = reverse(self.urlName) request = context['request'] if (settings.GEOCAM_UTIL_SECURITY_ENABLED and not requestIsSecure(request) and settings.GEOCAM_UTIL_SECURITY_REQUIRE_ENCRYPTED_PASSWORDS): secureUrl = re.sub('^http:', 'https:', request.build_absolute_uri(url)) + '?protocol=http' return secureUrl else: return url
def render(self, context): url = reverse(self.urlName) request = context['request'] if (settings.GEOCAM_UTIL_SECURITY_ENABLED and not requestIsSecure(request) and settings.GEOCAM_UTIL_SECURITY_REQUIRE_ENCRYPTED_PASSWORDS): secureUrl = re.sub( '^http:', 'https:', request.build_absolute_uri(url)) + '?protocol=http' return secureUrl else: return url
def getAccountWidget(request): if request.user.is_authenticated(): accountWidget = ('<a href="%(SCRIPT_NAME)saccounts/profile">%(username)s</a> <a href="%(SCRIPT_NAME)saccounts/logout/">Logout</a>' % dict(SCRIPT_NAME=settings.SCRIPT_NAME, username=request.user.username)) else: path = request.get_full_path() if requestIsSecure(request): path += '?protocol=http' # redirect back to http after login accountWidget = ('<div id="accountwidget"><a id="login_button" href="%(SCRIPT_NAME)saccounts/login?next=%(path)s">Login</a> | <a id="join_button" href="%(SCRIPT_NAME)saccounts/register">Join</a></div>' % dict(path=path, SCRIPT_NAME=settings.SCRIPT_NAME, username=request.user.username)) return accountWidget