Project

General

Profile

« Previous | Next » 

Revision 0dc8fd72

Added by Amir Fefer over 8 years ago

Fixes #11174 - Don't show password placeholder when empty

View differences:

app/helpers/compute_resources_helper.rb
opts.map{|n| [number_to_human_size(n*Foreman::SIZE[:giga]), (n*Foreman::SIZE[:giga]).to_i] unless n > (max_memory / Foreman::SIZE[:giga])}.compact
end
def password_placeholder(obj)
obj.id ? "********" : ""
def password_placeholder(obj, attr = nil)
pass = obj.read_attribute(attr).present? || obj.has_attribute?(:password_hash)
pass ? "********" : ''
end
def list_datacenters(compute)
app/helpers/layout_helper.rb
password_field_tag(:fakepassword, nil, :style => 'display: none') +
field(f, attr, options) do
options[:autocomplete] ||= 'off'
options[:placeholder] ||= password_placeholder(f.object)
options[:placeholder] ||= password_placeholder(f.object, attr)
addClass options, 'form-control'
f.password_field(attr, options) +
'<span class="glyphicon glyphicon-warning-sign input-addon"
app/views/compute_resources/form/_vmware.html.erb
<%= text_f f, :server, :label => _("VCenter/Server"), :size => "col-md-8", :help_inline => documentation_button('5.2.9VMwareNotes') %>
<%= text_f f, :user %>
<%= password_f f, :password, :placeholder => password_placeholder(f.object) %>
<%= password_f f, :password %>
<% datacenters = list_datacenters f.object%>
<%= selectable_f(f, :datacenter, datacenters, {}, {:label => _('Datacenter'),
:help_inline => link_to_function(datacenters.empty? ? "Load Datacenters" : "Test Connection", "testConnection(this)",

Also available in: Unified diff