Commit 1c3997a7 authored by Marin Jankovski's avatar Marin Jankovski

Merge branch 'replace_passwords_with_asterisk' into 'master'

Show asterisks instead of password in service edit form.

See merge request !1686
parents cca08e14 a1f5ae98
...@@ -265,4 +265,14 @@ module ProjectsHelper ...@@ -265,4 +265,14 @@ module ProjectsHelper
"success" "success"
end end
end end
def service_field_value(type, value)
return value unless type == 'password'
if value.present?
"***********"
else
nil
end
end
end end
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
- @service.fields.each do |field| - @service.fields.each do |field|
- name = field[:name] - name = field[:name]
- title = field[:title] || name.humanize - title = field[:title] || name.humanize
- value = @service.send(name) unless field[:type] == 'password' - value = service_field_value(field[:type], @service.send(name))
- type = field[:type] - type = field[:type]
- placeholder = field[:placeholder] - placeholder = field[:placeholder]
- choices = field[:choices] - choices = field[:choices]
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
- elsif type == 'select' - elsif type == 'select'
= f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" } = f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password' - elsif type == 'password'
= f.password_field name, class: 'form-control' = f.password_field name, placeholder: value, class: 'form-control'
- if help - if help
%span.help-block= help %span.help-block= help
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment