Commit c93fe6e9 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Auth providers messages updates

parent 066d9adb
......@@ -73,7 +73,8 @@ class AuthProvider(object):
module_active = False
module_enabled = False
one_per_user = False
login_prompt = _('Login using')
login_prompt = _('Login using ')
primary_login_prompt = _('Login using ')
def get_message(self, msg, **kwargs):
params = kwargs
......@@ -129,10 +130,10 @@ class LocalAuthProvider(AuthProvider):
module = 'local'
title = _('Local password')
description = _('Create a local password for your account')
create_prompt = _('Create an account')
add_prompt = _('Create a local password for your account')
login_prompt = _('if you already have a username and password')
signup_prompt = _('New to ~Okeanos ?')
signup_prompt = _('New to ~okeanos ?')
signup_link_prompt = _('create an account now')
@property
......@@ -152,25 +153,11 @@ class LocalAuthProvider(AuthProvider):
return [(_('Change password'), reverse('password_change')), ]
class LDAPAuthProvider(AuthProvider):
module = 'ldap'
title = _('LDAP credentials')
description = _('Allows you to login using your LDAP credentials')
one_per_user = True
login_template = 'im/auth/local_login_form.html'
login_prompt_template = 'im/auth/local_login_prompt.html'
signup_prompt_template = 'im/auth/local_signup_prompt.html'
details_tpl = _('You can login to your account using your'
' %(auth_backend)s password.')
class ShibbolethAuthProvider(AuthProvider):
module = 'shibboleth'
title = _('Academic credentials (Shibboleth)')
description = _('Allows you to login to your account using your academic '
'credentials')
add_prompt = _('Add academic credentials to your account.')
add_prompt = _('Allows you to login to your account using your academic '
'account')
details_tpl = _('Shibboleth account \'%(identifier)s\' is connected to your '
' account.')
user_title = _('Academic credentials (%(identifier)s)')
......@@ -189,9 +176,7 @@ class ShibbolethAuthProvider(AuthProvider):
class TwitterAuthProvider(AuthProvider):
module = 'twitter'
title = _('Twitter')
description = _('Allows you to login to your account using your Twitter '
'credentials')
add_prompt = _('Connect with your Twitter account.')
add_prompt = _('Allows you to login to your account using Twitter')
details_tpl = _('Twitter screen name: %(info_screen_name)s')
user_title = _('Twitter (%(info_screen_name)s)')
......@@ -199,16 +184,14 @@ class TwitterAuthProvider(AuthProvider):
def add_url(self):
return reverse('astakos.im.target.twitter.login')
login_template = 'im/auth/twitter_login.html'
login_prompt_template = 'im/auth/twitter_login_prompt.html'
login_template = 'im/auth/third_party_provider_generic_login.html'
login_prompt_template = 'im/auth/third_party_provider_generic_login_prompt.html'
class GoogleAuthProvider(AuthProvider):
module = 'google'
title = _('Google')
description = _('Allows you to login to your account using your Google '
'credentials')
add_prompt = _('Connect with your Google account.')
add_prompt = _('Allows you to login to your account using Google')
details_tpl = _('Google account: %(info_email)s')
user_title = _('Google (%(info_email)s)')
......@@ -223,11 +206,9 @@ class GoogleAuthProvider(AuthProvider):
class LinkedInAuthProvider(AuthProvider):
module = 'linkedin'
title = _('LinkedIn')
description = _('Allows you to login to your account using your LinkedIn '
'credentials')
add_prompt = _('Connect with your LinkedIn account.')
details_tpl = _('LinkedIn account: %(info_emailAddress)s')
add_prompt = _('Allows you to login to your account using LinkedIn')
user_title = _('LinkedIn (%(info_emailAddress)s)')
details_tpl = _('LinkedIn account: %(info_emailAddress)s')
@property
def add_url(self):
......
......@@ -31,6 +31,8 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from django.conf import settings
ACCOUNT_AUTHENTICATION_FAILED = 'Cannot authenticate account.'
ACCOUNT_ALREADY_ACTIVE = 'Account is already active.'
ACCOUNT_PENDING_ACTIVATION = 'Your request is pending activation.'
......@@ -146,11 +148,21 @@ DOMAIN_VALUE_ERR = 'Enter a valid domain.'
# Auth providers messages
AUTH_PROVIDER_NOT_ACTIVE = "'%(provider)s' is disabled"
AUTH_PROVIDER_NOT_ACTIVE_FOR_LOGIN = "Login using '%(provider)s' is disabled"
AUTH_PROVIDER_NOT_ACTIVE_FOR_USER_LOGIN = "You cannot login using '%(provider)s'"
AUTH_PROVIDER_NOT_ACTIVE_FOR_CREATE = "Signup using '%(provider)s' is disabled"
AUTH_PROVIDER_NOT_ACTIVE_FOR_ADD = "'%(provider)s is disabled."
AUTH_PROVIDER_NOT_ACTIVE_FOR_USER = "You cannot login using '%(provider)s'"
AUTH_PROVIDER_NOT_ACTIVE_FOR_CREATE = "Signup using '%(provider)s' is disabled."
AUTH_PROVIDER_NOT_ACTIVE_FOR_ADD = "You cannot add %(provider)s login method."
AUTH_PROVIDER_ADDED = "New login method added."
AUTH_PROVIDER_ADD_FAILED = "Failed to add new login method."
AUTH_PROVIDER_ADD_EXISTS = "Account already assigned to another user."
AUTH_PROVIDER_LOGIN_TO_ADD = "Please login now to your existing account."
AUTH_PROVIDER_LOGIN_TO_ADD = "The new login method will be assigned once you login to your account."
AUTH_PROVIDER_INVALID_LOGIN = "No account exists."
messages = locals().keys()
for msg in messages:
if msg == msg.upper():
attr = "ASTAKOS_%s_MESSAGE" % msg
settings_value = getattr(settings, attr, None)
if settings_value:
locals()[msg] = settings_value
<br />
{{ provider.get_signup_prompt_display }}
<a href="{% url astakos.im.views.signup %}{% ifnotequal code "" %}?code={{ code|urlencode }}{% endifnotequal %}">
{{ provider.get_create_prompt_display }}
</a>
<a href="{% url astakos.im.views.signup %}{% ifnotequal code "" %}?code={{ code|urlencode }}{% endifnotequal %}">{{ provider.get_signup_link_prompt_display }}</a>
<h2><a href="{{ provider.add_url }}">{{ provider.get_login_prompt_display }} {{ provider.get_title_display }}</a></h2>
<h2><a href="{{ provider.add_url }}">{{ provider.get_primary_login_prompt_display|safe }} {{ provider.get_title_display }}</a></h2>
<br />{{ provider.get_login_prompt_display }}
<Br />{{ provider.get_login_prompt_display|safe }}
<a href="{{ provider.add_url }}?{% ifnotequal next "" %}&next={{ next|urlencode }}{% endifnotequal %}{% ifnotequal code ""%}{% if next != "" %}&{% else %}?{% endif %}code={{ code }}{% endifnotequal %}"
alt="{{ provider.get_title_display }}">{{ provider.get_title_display }}</a>
<h2><a href="/im/login/shibboleth">LOGIN OR CREATE ACCOUNT USING SHIBBOLETH</a></h2>
<h2><a href="/im/login/{{ provider.add_url }}">{{ provider.get_login_prompt_display }}</a></h2>
<br />{{ provider.get_login_prompt_display }}
<a href="/im/login/twitter?{% ifnotequal next "" %}&next={{ next|urlencode }}{% endifnotequal %}{% ifnotequal code ""%}{% if next != "" %}&{% else %}?{% endif %}code={{ code }}{% endifnotequal %}"
alt="{{ provider.get_title_display }}">{{ provider.get_title_display }}</a>
<a href="/im/login/twitter?{% ifnotequal next "" %}&next={{ next|urlencode }}{% endifnotequal %}{% ifnotequal code ""%}{% if next != "" %}&{% else %}?{% endif %}code={{ code }}{% endifnotequal %}" alt="{{ provider.get_title_display }}">{{ provider.get_title_display }}</a>
......@@ -21,9 +21,9 @@
<div class="extralogin"
style="{% if not last_login_method or last_login_method == master_auth_provider.module %}display:none{% endif %}">
{% for provider in auth_providers %}
{% if not provider == master_auth_provider %}
{% include provider.login_prompt_template %}
{% endif %}
{% if not provider == master_auth_provider %}
{% include provider.login_prompt_template %}
{% endif %}
{% endfor %}
<div class="bottom">
{% block body.signup %}
......
......@@ -39,7 +39,7 @@
<p><a href="{{ provider.add_url }}?force_login=1">
{{ provider.get_title_display }}</a><br />
<span class="description">
{{ provider.get_description_display }}
{{ provider.get_add_prompt_display }}
</span>
</p>
{% empty %}
......
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