urls.py 3.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# CIRCLE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with CIRCLE.  If not, see <http://www.gnu.org/licenses/>.

18
from django.conf.urls import patterns, include, url
19
from django.views.generic import TemplateView
20

Bach Dániel committed
21
from django.conf import settings
22
from django.contrib import admin
23
from django.core.urlresolvers import reverse
Bach Dániel committed
24 25
from django.shortcuts import redirect

26

27
from circle.settings.base import get_env_variable
28 29 30
from dashboard.views import (
    CircleLoginView, HelpView, ResizeHelpView, TwoFactorLoginView
)
31
from dashboard.forms import CirclePasswordResetForm, CircleSetPasswordForm
32
from firewall.views import add_blacklist_item
33

34 35
admin.autodiscover()

Kálmán Viktor committed
36 37
urlpatterns = patterns(
    '',
38

39
    url(r'^$', lambda x: redirect(reverse("dashboard.index"))),
40
    url(r'^network/', include('network.urls')),
41
    url(r'^blacklist-add/', add_blacklist_item),
42
    url(r'^dashboard/', include('dashboard.urls')),
Kálmán Viktor committed
43
    url(r'^request/', include('request.urls')),
44

45 46 47
    # django/contrib/auth/urls.py (care when new version)
    url((r'^accounts/reset/(?P<uidb64>[0-9A-Za-z_\-]+)/'
         r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'),
48 49 50 51 52 53 54 55 56
        'django.contrib.auth.views.password_reset_confirm',
        {'set_password_form': CircleSetPasswordForm},
        name='accounts.password_reset_confirm'
        ),
    url(r'^accounts/password/reset/$', ("django.contrib.auth.views."
                                        "password_reset"),
        {'password_reset_form': CirclePasswordResetForm},
        name="accounts.password-reset",
        ),
57 58
    url(r'^accounts/login/?$', CircleLoginView.as_view(),
        name="accounts.login"),
59
    url(r'^accounts/', include('django.contrib.auth.urls')),
60 61 62
    url(r'^two-factor-login/$', TwoFactorLoginView.as_view(),
        name="two-factor-login"),

Őry Máté committed
63
    url(r'^info/help/$', HelpView.as_view(template_name="info/help.html"),
64 65 66 67 68 69 70 71 72 73
        name="info.help"),
    url(r'^info/policy/$',
        TemplateView.as_view(template_name="info/policy.html"),
        name="info.policy"),
    url(r'^info/legal/$',
        TemplateView.as_view(template_name="info/legal.html"),
        name="info.legal"),
    url(r'^info/support/$',
        TemplateView.as_view(template_name="info/support.html"),
        name="info.support"),
74 75
    url(r'^info/resize-how-to/$', ResizeHelpView.as_view(),
        name="info.resize"),
76
)
77 78


Bach Dániel committed
79 80 81 82 83 84
if 'rosetta' in settings.INSTALLED_APPS:
    urlpatterns += patterns(
        '',
        url(r'^rosetta/', include('rosetta.urls')),
    )

85 86 87 88 89 90
if settings.ADMIN_ENABLED:
    urlpatterns += patterns(
        '',
        url(r'^admin/', include(admin.site.urls)),
    )

Bach Dániel committed
91

92 93 94 95 96
if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
    urlpatterns += patterns(
        '',
        (r'^saml2/', include('djangosaml2.urls')),
    )
97 98

handler500 = 'common.views.handler500'
99
handler403 = 'common.views.handler403'