Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
0d02a287
Commit
0d02a287
authored
Mar 02, 2012
by
Sofia Papagiannaki
Browse files
changes in cloudier and signup & logout behavior
Refs: #2146
parent
81f840be
Changes
5
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/README
View file @
0d02a287
...
...
@@ -62,10 +62,14 @@ ASTAKOS_MODERATION_ENABLED True
ASTAKOS_BASEURL \http://pithos.dev.grnet.gr Astakos baseurl
ASTAKOS_SITENAME GRNET Cloud Service name that appears in emails
ASTAKOS_CLOUD_SERVICES ({'icon': 'home-icon.png', 'id': 'cloud', 'name': 'grnet cloud', 'url': '/'}, Cloud services appear in the horizontal bar
{'id': 'okeanos', 'name': '
~okeano
s', 'url': '/okeanos.html'},
{'id': 'okeanos', 'name': '
cyclade
s', 'url': '/okeanos.html'},
{'id': 'pithos', 'name': 'pithos+', 'url': '/ui/'})
ASTAKOS_RECAPTCHA_PUBLIC_KEY Recaptcha public key obtained after registration here: http://recaptcha.net
ASTAKOS_RECAPTCHA_PRIVATE_KEY Recaptcha private key obtained after registration here: http://recaptcha.net
ASTAKOS_RECAPTCHA_OPTIONS {'theme': 'white'} Options for customizing reCAPTCHA look and feel
(see: http://code.google.com/intl/el-GR/apis/recaptcha/docs/customization.html)
ASTAKOS_LOGOUT_NEXT Where the user should be redirected after logout
(if not set and no next parameter is defined it renders login page with message)
============================== ============================================================================= ===========================================================================================
Administrator functions
...
...
snf-astakos-app/astakos/im/api.py
View file @
0d02a287
...
...
@@ -124,23 +124,23 @@ def get_menu(request):
index_url
=
absolute
(
reverse
(
'astakos.im.views.index'
))
if
urlparse
(
location
).
query
.
rfind
(
'next='
)
==
-
1
:
index_url
=
'%s?next=%s'
%
(
index_url
,
quote
(
location
))
l
=
[{
'url'
:
index_url
,
'name'
:
"
login...
"
}]
l
=
[{
'url'
:
index_url
,
'name'
:
"
Signin
"
}]
if
request
.
user
.
is_authenticated
():
l
=
[]
l
.
append
({
'url'
:
absolute
(
reverse
(
'astakos.im.views.edit_profile'
)),
'name'
:
request
.
user
.
email
})
l
.
append
({
'url'
:
absolute
(
reverse
(
'astakos.im.views.edit_profile'
)),
'name'
:
"view your profile
...
"
})
'name'
:
"view your profile"
})
if
request
.
user
.
password
:
l
.
append
({
'url'
:
absolute
(
reverse
(
'password_change'
)),
'name'
:
"change your password
...
"
})
'name'
:
"change your password"
})
if
INVITATIONS_ENABLED
:
l
.
append
({
'url'
:
absolute
(
reverse
(
'astakos.im.views.invite'
)),
'name'
:
"invite some friends
...
"
})
'name'
:
"invite some friends"
})
l
.
append
({
'url'
:
absolute
(
reverse
(
'astakos.im.views.send_feedback'
)),
'name'
:
"feedback
...
"
})
'name'
:
"feedback"
})
l
.
append
({
'url'
:
absolute
(
reverse
(
'astakos.im.views.logout'
)),
'name'
:
"logout
...
"
})
'name'
:
"logout"
})
callback
=
request
.
GET
.
get
(
'callback'
,
None
)
data
=
json
.
dumps
(
tuple
(
l
))
...
...
snf-astakos-app/astakos/im/settings.py
View file @
0d02a287
...
...
@@ -50,7 +50,7 @@ SITENAME = getattr(settings, 'ASTAKOS_SITENAME', 'GRNET Cloud')
# Set cloud services appear in the horizontal bar
CLOUD_SERVICES
=
getattr
(
settings
,
'ASTAKOS_CLOUD_SERVICES'
,
(
{
'url'
:
'/'
,
'name'
:
'grnet cloud'
,
'id'
:
'cloud'
,
'icon'
:
'home-icon.png'
},
{
'url'
:
'/okeanos.html'
,
'name'
:
'
~okeano
s'
,
'id'
:
'okeanos'
},
{
'url'
:
'/okeanos.html'
,
'name'
:
'
cyclade
s'
,
'id'
:
'okeanos'
},
{
'url'
:
'/ui/'
,
'name'
:
'pithos+'
,
'id'
:
'pithos'
}))
# Set recaptcha keys
...
...
@@ -58,3 +58,6 @@ RECAPTCHA_PUBLIC_KEY = getattr(settings, 'ASTAKOS_RECAPTCHA_PUBLIC_KEY', '')
RECAPTCHA_PRIVATE_KEY
=
getattr
(
settings
,
'ASTAKOS_RECAPTCHA_PRIVATE_KEY'
,
''
)
RECAPTCHA_OPTIONS
=
getattr
(
settings
,
'ASTAKOS_RECAPTCHA_OPTIONS'
,
{
'theme'
:
'white'
})
# Set where the user should be redirected after logout
LOGOUT_NEXT
=
getattr
(
settings
,
'ASTAKOS_LOGOUT_NEXT'
,
''
)
snf-astakos-app/astakos/im/urls.py
View file @
0d02a287
...
...
@@ -33,7 +33,7 @@
from
django.conf.urls.defaults
import
patterns
,
include
,
url
from
astakos.im.forms
import
ExtendedPasswordResetForm
from
astakos.im.forms
import
ExtendedPasswordResetForm
,
LoginForm
from
astakos.im.settings
import
IM_MODULES
,
INVITATIONS_ENABLED
urlpatterns
=
patterns
(
'astakos.im.views'
,
...
...
@@ -41,8 +41,8 @@ urlpatterns = patterns('astakos.im.views',
url
(
r
'^login/?$'
,
'index'
),
url
(
r
'^profile/?$'
,
'edit_profile'
),
url
(
r
'^feedback/?$'
,
'send_feedback'
),
url
(
r
'^signup/?$'
,
'signup'
),
url
(
r
'^logout/?$'
,
'logout'
),
url
(
r
'^signup/?$'
,
'signup'
,
{
'on_success'
:
'im/login.html'
,
'extra_context'
:{
'form'
:
LoginForm
()}}
),
url
(
r
'^logout/?$'
,
'logout'
,
{
'template'
:
'im/login.html'
,
'extra_context'
:{
'form'
:
LoginForm
()}}
),
url
(
r
'^activate/?$'
,
'activate'
)
)
...
...
snf-astakos-app/astakos/im/views.py
View file @
0d02a287
...
...
@@ -55,7 +55,7 @@ from astakos.im.models import AstakosUser, Invitation
from
astakos.im.backends
import
get_backend
from
astakos.im.util
import
get_context
,
prepare_response
,
set_cookie
from
astakos.im.forms
import
*
from
astakos.im.settings
import
DEFAULT_CONTACT_EMAIL
,
DEFAULT_FROM_EMAIL
,
COOKIE_NAME
,
COOKIE_DOMAIN
,
IM_MODULES
,
SITENAME
,
BASEURL
from
astakos.im.settings
import
DEFAULT_CONTACT_EMAIL
,
DEFAULT_FROM_EMAIL
,
COOKIE_NAME
,
COOKIE_DOMAIN
,
IM_MODULES
,
SITENAME
,
BASEURL
,
LOGOUT_NEXT
from
astakos.im.functions
import
invite
as
invite_func
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -246,7 +246,6 @@ def edit_profile(request, template_name='im/profile.html', extra_context={}):
context_instance
=
get_context
(
request
,
extra_context
))
@
requires_anonymous
def
signup
(
request
,
on_failure
=
'im/signup.html'
,
on_success
=
'im/signup_complete.html'
,
extra_context
=
{},
backend
=
None
):
"""
Allows a user to create a local account.
...
...
@@ -283,6 +282,8 @@ def signup(request, on_failure='im/signup.html', on_success='im/signup_complete.
im/signup.html or ``on_failure`` keyword argument.
im/signup_complete.html or ``on_success`` keyword argument.
"""
if
request
.
user
.
is_authenticated
():
return
HttpResponseRedirect
(
reverse
(
'astakos.im.views.index'
))
try
:
if
not
backend
:
backend
=
get_backend
(
request
)
...
...
@@ -305,7 +306,7 @@ def signup(request, on_failure='im/signup.html', on_success='im/signup_complete.
return
prepare_response
(
request
,
user
,
next
=
next
)
messages
.
add_message
(
request
,
status
,
message
)
return
render_response
(
on_success
,
context_instance
=
get_context
(
request
,
extra_context
))
context_instance
=
get_context
(
request
,
extra_context
))
except
(
Invitation
.
DoesNotExist
,
ValueError
),
e
:
messages
.
add_message
(
request
,
messages
.
ERROR
,
e
)
for
provider
in
IM_MODULES
:
...
...
@@ -383,6 +384,11 @@ def logout(request, template='registration/logged_out.html', extra_context={}):
response
[
'Location'
]
=
next
response
.
status_code
=
302
return
response
elif
LOGOUT_NEXT
:
response
[
'Location'
]
=
LOGOUT_NEXT
response
.
status_code
=
301
return
response
messages
.
add_message
(
request
,
messages
.
SUCCESS
,
_
(
'You have successfully logged out.'
))
context
=
get_context
(
request
,
extra_context
)
response
.
write
(
render_to_string
(
template
,
context_instance
=
context
))
return
response
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment