Show WEBSSO disclaimer only when it is needed

Horizon can support several auth mechanisms, i.e. Keystone creds and
OpenID. User allowed to choose proper way of auth and disclaimer is
shown. But it is possible to allow choose from the only variant, and in
this case disclaimer also shown, which is confusing. Proposed patch fix
disclaimer display and makes it reasonable

Closes-bug: #1774623
Change-Id: Ib039c6fdf1e4cd21b5ebe426fe2a15355a37353c
This commit is contained in:
vmarkov 2018-06-01 13:56:56 +03:00
parent ca49cc15c0
commit 61a79a9b7a
2 changed files with 6 additions and 0 deletions

View File

@ -30,7 +30,9 @@
<input type="password" name="fake_password" value="" />
</div>
{%endif%}
{% if show_sso_opts %}
{% include "auth/_description.html" %}
{% endif %}
<fieldset hz-login-finder>
{% if request.user.is_authenticated and 'next' in request.GET %}
<div class="form-group clearfix error help-block alert alert-danger">

View File

@ -92,6 +92,10 @@ def login(request, template_name=None, extra_context=None, **kwargs):
extra_context['csrf_failure'] = request.GET.get('csrf_failure')
choices = getattr(settings, 'WEBSSO_CHOICES', ())
extra_context['show_sso_opts'] = (utils.is_websso_enabled() and
len(choices) > 1)
if not template_name:
if request.is_ajax():
template_name = 'auth/_login.html'