Commit 6a20a951 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Additional messages in third party registration/login process

parent c17c2179
......@@ -146,4 +146,5 @@ AUTH_PROVIDER_NOT_ACTIVE_FOR_CREATE = "Signup using '%(provider)s' is
AUTH_PROVIDER_NOT_ACTIVE_FOR_ADD = "'%(provider)s is disabled"
AUTH_PROVIDER_ADDED = "Your new login method has been added"
AUTH_PROVIDER_ADD_FAILED = "Failed to add new login method"
AUTH_PROVIDER_LOGIN_TO_ADD = "Please login now to your existing account."
......@@ -1152,7 +1152,7 @@ def astakosuser_post_save(sender, instance, created, **kwargs):
return
set_default_group(instance)
# TODO handle socket.error & IOError
register_users((instance,))
#register_users((instance,))
def resource_post_save(sender, instance, created, **kwargs):
......
......@@ -103,3 +103,9 @@ ul ul ul li { list-style-type:square; }
/* misc ---------------------------------------*/
img[align="left"] { margin:0 1em 0.5em 0; }
img[align="right"] { margin:0 0 0.5em 1em; }
/* button */
.button { display: inline-block; color: #fff; line-height: 22px; padding: 10px 22px; background-color: #F89A1C; margin-bottom: 10px;}
.button:hover { background-color: #3582AC;}
.button.wide { display: block;}
span.action-desc { display: block; color: #fff;}
......@@ -75,6 +75,9 @@ def login(request, on_failure='im/login.html'):
third_party_token = get_query(request).get('key', False)
if not form.is_valid():
if third_party_token:
messages.info(request, astakos_messages.AUTH_PROVIDER_LOGIN_TO_ADD)
return render_to_response(
on_failure,
{'login_form':form,
......
......@@ -164,6 +164,7 @@ def login(
user.save()
extra_context['provider'] = 'shibboleth'
extra_context['provider_title'] = 'Academic credentials'
extra_context['token'] = user.token
extra_context['signup_url'] = reverse('signup') + \
"?third_party_token=%s" % user.token
......
......@@ -173,6 +173,7 @@ def authenticated(
user.save()
extra_context['provider'] = 'twitter'
extra_context['provider_title'] = 'Twitter'
extra_context['token'] = user.token
extra_context['signup_url'] = reverse('signup') + \
"?third_party_token=%s" % user.token
......
......@@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="{{ resource.meta.compatibility }}">
<title>
{% block page.title %}{% endblock %} / GRNET Cloud Accounts
{% block page.title %}Accounts{% endblock %} / GRNET Cloud Accounts
</title>
<meta name="description" content="">
......
{% extends 'im/base_two_cols.html'%}
{% block signup_class %}hidden{% endblock %}
{% block page.title %}{% endblock %}
{% block body.left %}
<img class="pic" src="{{ IM_STATIC_URL }}images/porta.png" />
......
......@@ -13,8 +13,15 @@
{% if "local" in im_modules %}
<div class="form-stacked">
<h2><span>Already have an account?</span></h2>
<a href="{% url astakos.im.views.index %}?key={{ token }}">YES</a>
<a href="{{ signup_url }}">NO</a>
<a href="{% url astakos.im.views.index %}?key={{ token }}"
class="button wide">
<span class="left">YES</span>
<span class="action-desc right">I want to add '{{ provider_title }}' as a new login method for my existing account</span>
</a>
<a href="{{ signup_url }}?key={{ token }}" class="button wide">
<span class="left">NO</span>
<span class="right action-desc">I want to create a new account</span>
</a>
</div>
{% endif %}
{% endblock %}
......@@ -195,6 +195,10 @@ def index(request, login_template_name='im/login.html', profile_template_name='i
if request.user.is_authenticated():
return HttpResponseRedirect(reverse('astakos.im.views.edit_profile'))
third_party_token = request.GET.get('key', False)
if third_party_token:
messages.info(request, astakos_messages.AUTH_PROVIDER_LOGIN_TO_ADD)
return render_response(
template_name,
login_form = LoginForm(request=request),
......
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