urls.py 5.23 KB
Newer Older
Antony Chazapis's avatar
Antony Chazapis committed
1
# Copyright 2011-2012 GRNET S.A. All rights reserved.
2
#
3
4
5
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
6
#
7
8
9
#   1. Redistributions of source code must retain the above
#      copyright notice, this list of conditions and the following
#      disclaimer.
10
#
11
12
13
14
#   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.
15
#
16
17
18
19
20
21
22
23
24
25
26
27
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``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 GRNET S.A 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.
28
#
29
30
31
32
33
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
34
from django.conf.urls.defaults import patterns, include, url
35
from django.contrib.auth.views import password_change
36

37
38
39
from astakos.im.forms import (ExtendedPasswordResetForm,
                              ExtendedPasswordChangeForm,
                              ExtendedSetPasswordForm, LoginForm)
40
from astakos.im.settings import IM_MODULES, INVITATIONS_ENABLED, EMAILCHANGE_ENABLED
41

42
urlpatterns = patterns('astakos.im.views',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
43
44
    url(r'^$', 'index', {}, name='index'),
    url(r'^login/?$', 'index', {}, name='login'),
45
    url(r'^profile/?$', 'edit_profile', name='edit_profile'),
46
47
48
    url(r'^feedback/?$', 'feedback'),
    url(r'^signup/?$', 'signup', {'on_success':'im/login.html', 'extra_context':{'login_form':LoginForm()}}),
    url(r'^logout/?$', 'logout', {'template':'im/login.html', 'extra_context':{'login_form':LoginForm()}}),
49
50
    url(r'^activate/?$', 'activate'),
    url(r'^approval_terms/?$', 'approval_terms', {}, name='latest_terms'),
51
    url(r'^approval_terms/(?P<term_id>\d+)/?$', 'approval_terms'),
52
53
54
55
    url(r'^send/activation/(?P<user_id>\d+)/?$', 'send_activation', {},
        name='send_activation'),
    url(r'^remove_auth_provider/(?P<pk>\d+)?$', 'remove_auth_provider', {},
        name='remove_auth_provider')
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
56
57
)

58
59
60
if EMAILCHANGE_ENABLED:
    urlpatterns += patterns('astakos.im.views',
        url(r'^email_change/?$', 'change_email', {}, name='email_change'),
61
        url(r'^email_change/confirm/(?P<activation_key>\w+)/?$', 'change_email', {},
62
63
64
            name='email_change_confirm')
)
    
65
urlpatterns += patterns('astakos.im.target',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
66
    url(r'^login/redirect/?$', 'redirect.login')
67
68
)

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
69
if 'local' in IM_MODULES:
70
    urlpatterns += patterns('astakos.im.target',
71
72
73
74
75
76
        url(r'^local/?$', 'local.login'),
        url(r'^password_change/?$', 'local.password_change', {
            'post_change_redirect':'profile',
            'password_change_form':ExtendedPasswordChangeForm
            },
            name='password_change')
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
77
78
    )
    urlpatterns += patterns('django.contrib.auth.views',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
79
        url(r'^local/password_reset/?$', 'password_reset',
80
         {'email_template_name':'registration/password_email.txt',
81
          'password_reset_form':ExtendedPasswordResetForm}, name='password_reset'),
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
82
        url(r'^local/password_reset_done/?$', 'password_reset_done'),
83
        url(r'^local/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/?$',
84
         'password_reset_confirm', {'set_password_form':ExtendedSetPasswordForm}),
85
        url(r'^local/password/reset/complete/?$', 'password_reset_complete')
86
87
    )

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
88
if INVITATIONS_ENABLED:
89
    urlpatterns += patterns('astakos.im.views',
Antony Chazapis's avatar
Antony Chazapis committed
90
        url(r'^invite/?$', 'invite')
91
92
    )

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
93
if 'shibboleth' in IM_MODULES:
94
    urlpatterns += patterns('astakos.im.target',
95
        url(r'^login/shibboleth/?$', 'shibboleth.login'),
96
        url(r'^shibboleth/signup/([\w-]+)/?$', 'shibboleth.signup', {}, 'shibboleth_signup')
97
98
    )

Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
99
if 'twitter' in IM_MODULES:
100
    urlpatterns += patterns('astakos.im.target',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
101
102
        url(r'^login/twitter/?$', 'twitter.login'),
        url(r'^login/twitter/authenticated/?$', 'twitter.authenticated')
103
104
    )

105
urlpatterns += patterns('astakos.im.api.admin',
Sofia Papagiannaki's avatar
Sofia Papagiannaki committed
106
    url(r'^authenticate/?$', 'authenticate_old'),
107
    #url(r'^authenticate/v2/?$', 'authenticate'),
108
109
    url(r'^get_services/?$', 'get_services'),
    url(r'^get_menu/?$', 'get_menu'),
110
111
    url(r'^admin/api/v2.0/users/?$', 'get_user_by_email'),
    url(r'^admin/api/v2.0/users/(?P<user_id>.+?)/?$', 'get_user_by_username'),
112
)
113
114
115
116
117
118
119

urlpatterns += patterns('astakos.im.api.service',
    #url(r'^service/api/v2.0/tokens/(?P<token_id>.+?)/?$', 'validate_token'),
    url(r'^service/api/v2.0/feedback/?$', 'send_feedback'),
    url(r'^service/api/v2.0/users/?$', 'get_user_by_email'),
    url(r'^service/api/v2.0/users/(?P<user_id>.+?)/?$', 'get_user_by_username'),
)