16

I am using Ruby 1.8.7 with Rails 2.3.9. When creating a drop down of email addresses using collection select, the emails addresses are not displaying. Instead I am seeing "[email protected]" in the drop down. Is there some switch that is causing this?

There seems to be some javascript that is being applied to each item in the drop down by rails when it sees an email in the list. The javascript is not there when I just list the user names.

<script type="text/javascript">
/* <![CDATA[ */
3(function(){try{var s,a,i,j,r,c,l=document.getElementById("__cf_email__");a=l.getAttribute("cf_sec");if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
4/* ]]> */ 
<script/>
Yahel
  • 37,023
  • 22
  • 103
  • 153
Nicolo77
  • 1,825
  • 4
  • 24
  • 34

3 Answers3

47

Hoa you are correct this isn't rails related.

I found that this caused by the CDN we are using CloudFlare. As part of their security settings they obscure emails.

You can turn this off by going to the CloudFlare settings on your CloudFlare account and turn off E-mail Address Obfuscation.

Update: This is definitely a CloudFlare setting that prevents emails from being displayed (saw this happen in my active_admin), but know that you can also add some HTML to the output that CloudFlare will look for around the email output:

<!--email_off--> email@example.com <!--/email_off-->

Reference:

multimediaxp
  • 9,348
  • 13
  • 49
  • 80
Nicolo77
  • 1,825
  • 4
  • 24
  • 34
  • this is just wow. Never knew that cloudflare had such a "security" feature. Worked on my end when I disabled email obfuscation. I'm not really sure if doing the method would be beneficial. Cause in my case, an active admin page is being obfuscated, which technically isn't even accessible by crawlers and the like. – olleh Jan 22 '16 at 04:35
  • Still working...never thought that it would be cloudflare that cause this... Thanks ! :) – Moch. Rasyid Dec 11 '17 at 03:13
4

Adding to @Nicolo77 answer.

I have ran into same issue. Cloud flare by default Turn on Email Address Obfuscation. You can change it on your could flare dashboard:

Login->Scrape Shield->Email Address Obfuscation -> Turn Off

Dheeraj Palagiri
  • 1,829
  • 3
  • 23
  • 46
0

The should be a switch when you go to Security Settings -> E-mail Address Obfuscation .

user3302709
  • 998
  • 8
  • 9
  • where? why? some details would really help. – Nuriel May 27 '15 at 07:10
  • Though maybe he could have elaborate it more, I think this answer was ultimately right. -1 is a bit too harsh, so I upvote it ;p – Quv Apr 12 '17 at 05:47