Revision 0d02a287
b/snf-astakos-app/README | ||
---|---|---|
62 | 62 |
ASTAKOS_BASEURL \http://pithos.dev.grnet.gr Astakos baseurl |
63 | 63 |
ASTAKOS_SITENAME GRNET Cloud Service name that appears in emails |
64 | 64 |
ASTAKOS_CLOUD_SERVICES ({'icon': 'home-icon.png', 'id': 'cloud', 'name': 'grnet cloud', 'url': '/'}, Cloud services appear in the horizontal bar |
65 |
{'id': 'okeanos', 'name': '~okeanos', 'url': '/okeanos.html'},
|
|
65 |
{'id': 'okeanos', 'name': 'cyclades', 'url': '/okeanos.html'},
|
|
66 | 66 |
{'id': 'pithos', 'name': 'pithos+', 'url': '/ui/'}) |
67 | 67 |
ASTAKOS_RECAPTCHA_PUBLIC_KEY Recaptcha public key obtained after registration here: http://recaptcha.net |
68 | 68 |
ASTAKOS_RECAPTCHA_PRIVATE_KEY Recaptcha private key obtained after registration here: http://recaptcha.net |
69 |
ASTAKOS_RECAPTCHA_OPTIONS {'theme': 'white'} Options for customizing reCAPTCHA look and feel |
|
70 |
(see: http://code.google.com/intl/el-GR/apis/recaptcha/docs/customization.html) |
|
71 |
ASTAKOS_LOGOUT_NEXT Where the user should be redirected after logout |
|
72 |
(if not set and no next parameter is defined it renders login page with message) |
|
69 | 73 |
============================== ============================================================================= =========================================================================================== |
70 | 74 |
|
71 | 75 |
Administrator functions |
b/snf-astakos-app/astakos/im/api.py | ||
---|---|---|
124 | 124 |
index_url = absolute(reverse('astakos.im.views.index')) |
125 | 125 |
if urlparse(location).query.rfind('next=') == -1: |
126 | 126 |
index_url = '%s?next=%s' % (index_url, quote(location)) |
127 |
l = [{ 'url': index_url, 'name': "login..."}]
|
|
127 |
l = [{ 'url': index_url, 'name': "Signin"}]
|
|
128 | 128 |
if request.user.is_authenticated(): |
129 | 129 |
l = [] |
130 | 130 |
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')), |
131 | 131 |
'name': request.user.email}) |
132 | 132 |
l.append({ 'url': absolute(reverse('astakos.im.views.edit_profile')), |
133 |
'name': "view your profile..." })
|
|
133 |
'name': "view your profile" }) |
|
134 | 134 |
if request.user.password: |
135 | 135 |
l.append({ 'url': absolute(reverse('password_change')), |
136 |
'name': "change your password..." })
|
|
136 |
'name': "change your password" }) |
|
137 | 137 |
if INVITATIONS_ENABLED: |
138 | 138 |
l.append({ 'url': absolute(reverse('astakos.im.views.invite')), |
139 |
'name': "invite some friends..." })
|
|
139 |
'name': "invite some friends" }) |
|
140 | 140 |
l.append({ 'url': absolute(reverse('astakos.im.views.send_feedback')), |
141 |
'name': "feedback..." })
|
|
141 |
'name': "feedback" }) |
|
142 | 142 |
l.append({ 'url': absolute(reverse('astakos.im.views.logout')), |
143 |
'name': "logout..."})
|
|
143 |
'name': "logout"}) |
|
144 | 144 |
|
145 | 145 |
callback = request.GET.get('callback', None) |
146 | 146 |
data = json.dumps(tuple(l)) |
b/snf-astakos-app/astakos/im/settings.py | ||
---|---|---|
50 | 50 |
# Set cloud services appear in the horizontal bar |
51 | 51 |
CLOUD_SERVICES = getattr(settings, 'ASTAKOS_CLOUD_SERVICES', ( |
52 | 52 |
{ 'url':'/', 'name':'grnet cloud', 'id':'cloud', 'icon':'home-icon.png' }, |
53 |
{ 'url':'/okeanos.html', 'name':'~okeanos', 'id':'okeanos' },
|
|
53 |
{ 'url':'/okeanos.html', 'name':'cyclades', 'id':'okeanos' },
|
|
54 | 54 |
{ 'url':'/ui/', 'name':'pithos+', 'id':'pithos' })) |
55 | 55 |
|
56 | 56 |
# Set recaptcha keys |
... | ... | |
58 | 58 |
RECAPTCHA_PRIVATE_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PRIVATE_KEY', '') |
59 | 59 |
RECAPTCHA_OPTIONS = getattr(settings, 'ASTAKOS_RECAPTCHA_OPTIONS', {'theme': 'white'}) |
60 | 60 |
|
61 |
# Set where the user should be redirected after logout |
|
62 |
LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '') |
|
63 |
|
b/snf-astakos-app/astakos/im/urls.py | ||
---|---|---|
33 | 33 |
|
34 | 34 |
from django.conf.urls.defaults import patterns, include, url |
35 | 35 |
|
36 |
from astakos.im.forms import ExtendedPasswordResetForm |
|
36 |
from astakos.im.forms import ExtendedPasswordResetForm, LoginForm
|
|
37 | 37 |
from astakos.im.settings import IM_MODULES, INVITATIONS_ENABLED |
38 | 38 |
|
39 | 39 |
urlpatterns = patterns('astakos.im.views', |
... | ... | |
41 | 41 |
url(r'^login/?$', 'index'), |
42 | 42 |
url(r'^profile/?$', 'edit_profile'), |
43 | 43 |
url(r'^feedback/?$', 'send_feedback'), |
44 |
url(r'^signup/?$', 'signup'), |
|
45 |
url(r'^logout/?$', 'logout'), |
|
44 |
url(r'^signup/?$', 'signup', {'on_success':'im/login.html', 'extra_context':{'form':LoginForm()}}),
|
|
45 |
url(r'^logout/?$', 'logout', {'template':'im/login.html', 'extra_context':{'form':LoginForm()}}),
|
|
46 | 46 |
url(r'^activate/?$', 'activate') |
47 | 47 |
) |
48 | 48 |
|
b/snf-astakos-app/astakos/im/views.py | ||
---|---|---|
55 | 55 |
from astakos.im.backends import get_backend |
56 | 56 |
from astakos.im.util import get_context, prepare_response, set_cookie |
57 | 57 |
from astakos.im.forms import * |
58 |
from astakos.im.settings import DEFAULT_CONTACT_EMAIL, DEFAULT_FROM_EMAIL, COOKIE_NAME, COOKIE_DOMAIN, IM_MODULES, SITENAME, BASEURL |
|
58 |
from astakos.im.settings import DEFAULT_CONTACT_EMAIL, DEFAULT_FROM_EMAIL, COOKIE_NAME, COOKIE_DOMAIN, IM_MODULES, SITENAME, BASEURL, LOGOUT_NEXT
|
|
59 | 59 |
from astakos.im.functions import invite as invite_func |
60 | 60 |
|
61 | 61 |
logger = logging.getLogger(__name__) |
... | ... | |
246 | 246 |
context_instance = get_context(request, |
247 | 247 |
extra_context)) |
248 | 248 |
|
249 |
@requires_anonymous |
|
250 | 249 |
def signup(request, on_failure='im/signup.html', on_success='im/signup_complete.html', extra_context={}, backend=None): |
251 | 250 |
""" |
252 | 251 |
Allows a user to create a local account. |
... | ... | |
283 | 282 |
im/signup.html or ``on_failure`` keyword argument. |
284 | 283 |
im/signup_complete.html or ``on_success`` keyword argument. |
285 | 284 |
""" |
285 |
if request.user.is_authenticated(): |
|
286 |
return HttpResponseRedirect(reverse('astakos.im.views.index')) |
|
286 | 287 |
try: |
287 | 288 |
if not backend: |
288 | 289 |
backend = get_backend(request) |
... | ... | |
305 | 306 |
return prepare_response(request, user, next=next) |
306 | 307 |
messages.add_message(request, status, message) |
307 | 308 |
return render_response(on_success, |
308 |
context_instance=get_context(request, extra_context)) |
|
309 |
context_instance=get_context(request, extra_context))
|
|
309 | 310 |
except (Invitation.DoesNotExist, ValueError), e: |
310 | 311 |
messages.add_message(request, messages.ERROR, e) |
311 | 312 |
for provider in IM_MODULES: |
... | ... | |
383 | 384 |
response['Location'] = next |
384 | 385 |
response.status_code = 302 |
385 | 386 |
return response |
387 |
elif LOGOUT_NEXT: |
|
388 |
response['Location'] = LOGOUT_NEXT |
|
389 |
response.status_code = 301 |
|
390 |
return response |
|
391 |
messages.add_message(request, messages.SUCCESS, _('You have successfully logged out.')) |
|
386 | 392 |
context = get_context(request, extra_context) |
387 | 393 |
response.write(render_to_string(template, context_instance=context)) |
388 | 394 |
return response |
Also available in: Unified diff