예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
파일: auth.py 프로젝트: GGSN/geocamUtilWeb
def getAccountWidget(request):
    if request.user.is_authenticated():
        accountWidget = ('<a href="%(SCRIPT_NAME)saccounts/profile">%(username)s</a>&nbsp;<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
예제 #4
0
def getAccountWidget(request):
    if request.user.is_authenticated():
        accountWidget = ('<a href="%(SCRIPT_NAME)saccounts/profile">%(username)s</a>&nbsp;<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