From 75b065b79c75e5ecb2e22db65964c3ba27474258 Mon Sep 17 00:00:00 2001 From: Simon Murray Date: Wed, 27 Jul 2016 13:24:19 +0100 Subject: [PATCH] Allow Optional Password Auto-Completion Extends the class interface to allow the login form's password field to be automatically completed by the client browser. Defaults to 'off' to maintain backwards compatibility with previous releases. Change-Id: Id7e2ecd8502bb077679a2820ff0425ad519555d2 --- manifests/init.pp | 7 +++++++ spec/classes/horizon_init_spec.rb | 5 ++++- templates/local_settings.py.erb | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 824e38f6..2920db74 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -266,6 +266,11 @@ # (optional) The default theme to use from list of available themes. Value should be theme_name. # Defaults to false # +# [*password_autocomplete*] +# (optional) Whether to instruct the client browser to autofill the login form password +# Valid values are 'on' and 'off' +# Defaults to 'off' +# # === DEPRECATED group/name # # [*fqdn*] @@ -359,6 +364,7 @@ class horizon( $vhost_extra_params = undef, $available_themes = false, $default_theme = false, + $password_autocomplete = 'off', # DEPRECATED PARAMETERS $custom_theme_path = undef, $fqdn = undef, @@ -430,6 +436,7 @@ class horizon( $keystone_options_real = merge($keystone_defaults, $keystone_options) $neutron_options_real = merge($neutron_defaults,$neutron_options) validate_hash($api_versions) + validate_re($password_autocomplete, ['^on$', '^off$']) if $cache_backend =~ /MemcachedCache/ { ensure_packages('python-memcache', diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 347091c4..988f574e 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -59,6 +59,7 @@ describe 'horizon' do "LOGIN_REDIRECT_URL = '#{platforms_params[:root_url]}/'", "ALLOWED_HOSTS = ['*', ]", " 'identity': 3,", + 'HORIZON_CONFIG["password_autocomplete"] = "off"', "SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'", 'OPENSTACK_KEYSTONE_URL = "http://127.0.0.1:5000"', 'OPENSTACK_KEYSTONE_DEFAULT_ROLE = "_member_"', @@ -122,7 +123,8 @@ describe 'horizon' do { 'name' => 'default', 'label' => 'Default', 'path' => 'themes/default' }, { 'name' => 'material', 'label' => 'Material', 'path' => 'themes/material' }, ], - :default_theme => 'default' + :default_theme => 'default', + :password_autocomplete => 'on', }) end @@ -135,6 +137,7 @@ describe 'horizon' do " 'identity': 2.0,", "OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True", "OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'domain.tld'", + 'HORIZON_CONFIG["password_autocomplete"] = "on"', "SECRET_KEY = 'elj1IWiLoWHgcyYxFVLj7cM5rGOOxWl0'", " 'DEAD_RETRY': 1,", " 'SERVER_RETRIES': 1,", diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index 7ee13f92..5ef76a9b 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -131,6 +131,7 @@ HORIZON_CONFIG = { # Turn off browser autocompletion for forms including the login form and # the database creation workflow if so desired. #HORIZON_CONFIG["password_autocomplete"] = "off" +HORIZON_CONFIG["password_autocomplete"] = "<%= @password_autocomplete %>" # Setting this to True will disable the reveal button for password fields, # including on the login form.