コード例 #1
0
ファイル: geocamAuth.py プロジェクト: geocam/geocamUtilWeb
 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