summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2013-10-30 22:20:48 +0100
committervarac <varacanero@zeromail.org>2013-10-30 22:20:48 +0100
commit71cb0f4c2c3bf95f62c9f189f5cef155b09a9682 (patch)
tree9e3ee649b700423fb8bce297258465676584ef31
parent73b69e8198f702f086ff6afd94a54dddc7935893 (diff)
obfuscate_email(): allow multiple email addresses
see https://leap.se/code/issues/4193 for more information
-rw-r--r--lib/puppet/parser/functions/obfuscate_email.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/puppet/parser/functions/obfuscate_email.rb b/lib/puppet/parser/functions/obfuscate_email.rb
index 07ccf72..4e4cb82 100644
--- a/lib/puppet/parser/functions/obfuscate_email.rb
+++ b/lib/puppet/parser/functions/obfuscate_email.rb
@@ -1,17 +1,15 @@
module Puppet::Parser::Functions
newfunction(:obfuscate_email, :type => :rvalue, :doc => <<-EOS
Given:
- an email in form of john@doe.com
+ a comma seperated email string in form of 'john@doe.com, doe@john.com'
-This function will return an obfuscated email in form of 'john {at} doe {dot} com'
+This function will return all emails obfuscated in form of 'john {at} doe {dot} com, doe {at} john {dot} com'
+Works with multiple email adresses as well as with a single email adress.
EOS
) do |args|
- email=args[0]
- email["@"]= " {at} "
- email=email.gsub(/(.*)(\.)(.*)/, '\1 {dot} \3')
- email
- end
+ args[0].gsub('@', ' {at} ').gsub('.', ' {dot} ')
+ end
end
# vim: set ts=2 sw=2 et :