Commit 1e38b1cb authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

New login messages feature

display messages on top of login page. Configurable from the
ASTAKOS_LOGIN_MESSAGES setting.
parent 7c706f5f
v0.3.6
======
- New ASTAKOS_LOGIN_MESSAGES setting to display messages on the login page
header
v0.3.5
======
......
......@@ -32,7 +32,7 @@
# or implied, of GRNET S.A.
from astakos.im.settings import IM_MODULES, INVITATIONS_ENABLED, IM_STATIC_URL, \
COOKIE_NAME
COOKIE_NAME, LOGIN_MESSAGES
from astakos.im.api import get_menu
from django.conf import settings
......@@ -54,6 +54,9 @@ def invitations(request):
def media(request):
return {'IM_STATIC_URL' : IM_STATIC_URL}
def login_messages(request):
return {'LOGIN_MESSAGES' : LOGIN_MESSAGES }
def menu(request):
absolute = lambda (url): request.build_absolute_uri(url)
resp = get_menu(request, True, False)
......
......@@ -64,3 +64,7 @@ LOGOUT_NEXT = getattr(settings, 'ASTAKOS_LOGOUT_NEXT', '')
# Set user email patterns that are automatically activated
RE_USER_EMAIL_PATTERNS = getattr(settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
# messages to display on login page header
LOGIN_MESSAGES = getattr(settings, 'ASTAKOS_LOGIN_MESSAGES', {})
......@@ -54,6 +54,7 @@ context_processors = [
'astakos.im.context_processors.code',
'astakos.im.context_processors.invitations',
'astakos.im.context_processors.menu',
'astakos.im.context_processors.login_messages',
'synnefo.lib.context_processors.cloudbar'
]
......
......@@ -89,8 +89,9 @@
</div>
{% endblock %}
</div>
{% if messages %}
{% if messages or LOGIN_MESSAGES %}
<ul class="messages">
{% block extra_messages %}{% endblock %}
{% for message in messages %}
<li{% if message.tags %}
class="{{ message.tags }}"{% endif %}>
......
{% extends 'im/base_two_cols.html'%}
{% block extra_messages %}
{% if not messages %}
{% for msg_type, msg in LOGIN_MESSAGES.items %}
<li class="{{ msg_type }}">{{ msg|safe }}</li>
{% endfor %}
{% endif %}
{% endblock %}
{% block signup_class %}hidden{% endblock %}
{% block page.title %}
Login
......
......@@ -64,5 +64,8 @@
#ASTAKOS_LOGOUT_NEXT = ''
# Set user email patterns that are automatically activated
#RE_USER_EMAIL_PATTERNS = getattr(settings, 'ASTAKOS_RE_USER_EMAIL_PATTERNS', [])
#ASTAKOS_RE_USER_EMAIL_PATTERNS = []
# Messages to display on login page header
# e.g. {'warning': 'This warning message will be displayed on the top of login page'}
#ASTAKOS_LOGIN_MESSAGES = {}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment