Exemplo n.º 1
0

def is_anonymous(func, next_url):
    def wrapped(request, *args, **kwargs):
        if request.user.is_authenticated():
            return HttpResponseRedirect(next_url)
        return func(request, *args, **kwargs)

    return wrapped


if settings.DEBUG:
    from django.views.defaults import server_error
    from ..views.errors import permission_denied, page_not_found
    urlpatterns = site_patterns(url(r'^403/$', permission_denied),
                                url(r'^404/$', page_not_found),
                                url(r'^500/$', server_error))
else:
    urlpatterns = []

urlpatterns += site_patterns(
    # HTTP request pipeline and visual appearence.
    url_direct(
        r'^api/credentials/(%(organization)s/)?',  # site/subdomain
        CredentialsAPIView.as_view(),
        name='api_credentials'),
    url_direct(r'^api/notifications/(?P<template>%s)/' % ACCT_REGEX,
               NotificationAPIView.as_view(),
               name='api_notification_send_test_email'),
    url_direct(r'^api/notifications/',
               NotificationAPIView.as_view(),
Exemplo n.º 2
0
# Copyright (c) 2019, DjaoDjin inc.
# see LICENSE

from django.conf import settings
from django.views.generic import TemplateView
from multitier.urlresolvers import site_patterns
from urldecorators import include, url

if settings.DEBUG:
    from django.views.defaults import server_error
    from ..views.errors import permission_denied, page_not_found
    urlpatterns = site_patterns(
        url(r'^403/$', permission_denied), url(r'^404/$', page_not_found),
        url(r'^500/$', server_error),
        url(r'^register/disabled/$',
            TemplateView.as_view(template_name='accounts/disabled.html')))
else:
    urlpatterns = []

urlpatterns += site_patterns(
    url(r'^', include('djaoapp.urls.api')),
    url(r'^', include('djaoapp.urls.views')),
)
Exemplo n.º 3
0
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from django.conf.urls import include, url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView

from multitier.urlresolvers import site_patterns


urlpatterns = site_patterns(
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^accounts/profile/',
        login_required(
            TemplateView.as_view(template_name='index.html')),
        name='accounts_profile'),
    url(r'^$', TemplateView.as_view(template_name='index.html')),
)
Exemplo n.º 4
0
#    this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
#    this list of conditions and the following disclaimer in the documentation
#    and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from django.conf.urls import include, url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView

from multitier.urlresolvers import site_patterns

urlpatterns = site_patterns(
    url(r'^', include('django.contrib.auth.urls')),
    url(r'^accounts/profile/',
        login_required(TemplateView.as_view(template_name='index.html')),
        name='accounts_profile'),
    url(r'^$', TemplateView.as_view(template_name='index.html')),
)
Exemplo n.º 5
0
# Copyright (c) 2019, DjaoDjin inc.
# see LICENSE

from django.conf import settings
from multitier.urlresolvers import site_patterns
from urldecorators import include, url

if settings.DEBUG:
    from django.views.defaults import server_error
    from ..views.errors import permission_denied, page_not_found
    urlpatterns = site_patterns(
        url(r'^403/$', permission_denied),
        url(r'^404/$', page_not_found),
        url(r'^500/$', server_error)
    )
else:
    urlpatterns = []

urlpatterns += site_patterns(
    url(r'^', include('djaoapp.urls.api')),
    url(r'^', include('djaoapp.urls.views')),
)