Hide password in the service settings form

This commit is contained in:
Valery Sizov 2015-10-01 17:33:05 +03:00
parent 2fa89a3dc6
commit 731b860976
5 changed files with 14 additions and 3 deletions

View file

@ -26,6 +26,7 @@ v 8.1.0 (unreleased)
- Show additions/deletions stats on merge request diff
- Remove footer text in emails (Zeger-Jan van de Weg)
- Ensure code blocks are properly highlighted after a note is updated
- Hide password in the service settings form
v 8.0.3
- Fix URL shown in Slack notifications

View file

@ -58,6 +58,8 @@ class Projects::ServicesController < Projects::ApplicationController
end
def service_params
params.require(:service).permit(ALLOWED_PARAMS)
service_params = params.require(:service).permit(ALLOWED_PARAMS)
service_params.delete("password") if service_params["password"].blank?
service_params
end
end

View file

@ -8,6 +8,9 @@
- help = field[:help]
.form-group
- if type == "password" && value.present?
= form.label name, "Change #{title}", class: "control-label"
- else
= form.label name, title, class: "control-label"
.col-sm-10
- if type == 'text'
@ -19,6 +22,6 @@
- elsif type == 'select'
= form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password'
= form.password_field name, value: value, class: 'form-control'
= form.password_field name, autocomplete: "new-password", class: 'form-control'
- if help
%span.help-block= help

View file

@ -72,6 +72,7 @@ Feature: Project Services
And I click Atlassian Bamboo CI service link
And I fill Atlassian Bamboo CI settings
Then I should see Atlassian Bamboo CI service settings saved
And I should see empty field Change Password
Scenario: Activate jetBrains TeamCity CI service
When I visit project "Shop" services page

View file

@ -202,6 +202,10 @@ class Spinach::Features::ProjectServices < Spinach::FeatureSteps
expect(find_field('Username').value).to eq 'user'
end
step 'I should see empty field Change Password' do
expect(find_field('Change Password').value).to be_nil
end
step 'I click JetBrains TeamCity CI service link' do
click_link 'JetBrains TeamCity CI'
end