diff --git a/app/controllers/ops_controller/settings/zones.rb b/app/controllers/ops_controller/settings/zones.rb index 16b797068e2..fc8ebfa45ea 100644 --- a/app/controllers/ops_controller/settings/zones.rb +++ b/app/controllers/ops_controller/settings/zones.rb @@ -28,9 +28,6 @@ def zone_edit unless @edit[:new][:description] add_flash(_("Description can't be blank"), :error) end - unless @edit[:new][:password] == @edit[:new][:verify] - add_flash(_('Password and Verify Password fields do not match'), :error) - end # This is needed for cases when more than one required field is missing or is not correct, to prevent rendering same flash messages if @flash_array @@ -39,7 +36,8 @@ def zone_edit end zone_set_record_vars(@zone) - if valid_record?(@zone) && @zone.save + @edit[:errors] = [] + if @zone.save AuditEvent.success(build_created_audit(@zone, @edit)) if params[:button] == "save" add_flash(_("Zone \"%{name}\" was saved") % {:name => @edit[:new][:name]}) @@ -115,30 +113,13 @@ def zone_set_record_vars(zone, mode = nil) zone.settings ||= {} zone.settings[:proxy_server_ip] = @edit[:new][:proxy_server_ip] zone.settings[:concurrent_vm_scans] = @edit[:new][:concurrent_vm_scans] - - zone.update_authentication({:windows_domain => {:userid => @edit[:new][:userid], :password => @edit[:new][:password]}}, {:save => (mode != :validate)}) - end - - # Validate the zone record fields - def valid_record?(zone) - valid = true - @edit[:errors] = [] - if zone.authentication_password.present? && zone.authentication_userid.blank? - @edit[:errors].push(_("Username must be entered if Password is entered")) - valid = false - end - if @edit[:new][:password] != @edit[:new][:verify] - @edit[:errors].push(_("Password and Verify Password fields do not match")) - valid = false - end - valid end # Get variables from zone edit form def zone_get_form_vars @zone = @edit[:zone_id] ? Zone.find(@edit[:zone_id]) : Zone.new - copy_params_if_present(@edit[:new], params, %i[name description proxy_server_ip userid password verify]) + copy_params_if_present(@edit[:new], params, %i[name description proxy_server_ip]) @edit[:new][:concurrent_vm_scans] = params[:max_scans].to_i if params[:max_scans] set_verify_status @@ -164,10 +145,6 @@ def zone_set_form_vars @edit[:new][:proxy_server_ip] = @zone.settings ? @zone.settings[:proxy_server_ip] : nil @edit[:new][:concurrent_vm_scans] = @zone.settings ? @zone.settings[:concurrent_vm_scans].to_i : 0 - @edit[:new][:userid] = @zone.authentication_userid(:windows_domain) - @edit[:new][:password] = @zone.authentication_password(:windows_domain) - @edit[:new][:verify] = @zone.authentication_password(:windows_domain) - session[:verify_ems_status] = nil set_verify_status diff --git a/app/views/ops/_zone_form.html.haml b/app/views/ops/_zone_form.html.haml index ca253f6fe0e..0c16acf2513 100644 --- a/app/views/ops/_zone_form.html.haml +++ b/app/views/ops/_zone_form.html.haml @@ -40,37 +40,6 @@ = javascript_tag(javascript_focus('proxy_server_ip')) %hr -%h3 - = _("Credentials - Windows Domain") -.form-horizontal - .form-group - %label.control-label.col-md-2 - = _("Username") - .col-md-8 - = text_field_tag("userid", - @edit[:new][:userid], - :maxlength => 50, - :class => "form-control", - "data-miq_observe" => {:interval => '.5', :url => url}.to_json) - .form-group - %label.control-label.col-md-2 - = _("Password") - .col-md-8 - = password_field_tag("password", - @edit[:new][:password], - :maxlength => 50, - :class => "form-control", - "data-miq_observe" => {:interval => '.5', :url => url}.to_json) - .form-group - %label.control-label.col-md-2 - = _("Verify Password") - .col-md-8 - = password_field_tag("verify", - @edit[:new][:verify], - :maxlength => 50, - :class => "form-control", - "data-miq_observe" => {:interval => '.5', :url => url}.to_json) -%hr %h3 = _("Settings") .form-horizontal diff --git a/spec/controllers/ops_controller/settings/zones_spec.rb b/spec/controllers/ops_controller/settings/zones_spec.rb index c3928492cd3..ded2d8bf65f 100644 --- a/spec/controllers/ops_controller/settings/zones_spec.rb +++ b/spec/controllers/ops_controller/settings/zones_spec.rb @@ -12,8 +12,7 @@ it 'sets flash array according to the missing name, description and verify password' do controller.send(:zone_edit) expect(controller.instance_variable_get(:@flash_array)).to eq([{:message => "Name can't be blank", :level => :error}, - {:message => "Description can't be blank", :level => :error}, - {:message => "Password and Verify Password fields do not match", :level => :error}]) + {:message => "Description can't be blank", :level => :error}]) end end