ualibraries / Guide-on-the-Side

The University of Arizona Libraries will no longer provide support for Guide on the Side. The code will remain openly available; however, UAL can no longer provide code fixes or upgrades.
https://ualibraries.github.io/Guide-on-the-Side/about.html
Other
66 stars 48 forks source link

Add honeypot spam protection to fix #113. #114

Closed michaelhagedon closed 9 years ago

michaelhagedon commented 9 years ago

I'm tired of getting spam. :-)

simpsonw commented 9 years ago

@michaelhagedon, this looks good to me, but I'm having some trouble with the email functionality on my local build. I will look at this as soon as I have that fixed.

simpsonw commented 9 years ago

@michaelhagedon The feedback mail functionality seems to be broken for me. I've tried it both on webdev and my local build with no luck. I checked the logs and saw

2015-02-11 11:04:09 Error: [SocketException] Invalid email: ""
Request URL: /applications/quickHelp/tutorials/provide_feedback/336

Are you still getting spam messages?

michaelhagedon commented 9 years ago

Are the email settings in config.yml filled out?

From: Will Simpson [mailto:notifications@github.com] Sent: Wednesday, February 11, 2015 11:10 AM To: ualibraries/Guide-on-the-Side Cc: Hagedon, Mike - (mhagedon) Subject: Re: [Guide-on-the-Side] Add honeypot spam protection to fix #113. (#114)

@michaelhagedonhttps://github.com/michaelhagedon The feedback mail functionality seems to be broken for me. I've tried it both on webdev and my local build with no luck. I checked the logs and saw

2015-02-11 11:04:09 Error: [SocketException] Invalid email: ""

Request URL: /applications/quickHelp/tutorials/provide_feedback/336

Are you still getting spam messages?

— Reply to this email directly or view it on GitHubhttps://github.com/ualibraries/Guide-on-the-Side/pull/114#issuecomment-73931920.

simpsonw commented 9 years ago

@michaelhagedon My local settings are:

email:
  # smtp (recommended) or php
  transport: smtp
  send_from: lbry-webadmin@email.arizona.edu
  send_all_feedback_to: wss.simpson@gmail.com 
  log: false

The webdev settings are:

email:
  send_from: webadmin@u.library.arizona.edu
  #send_all_feedback_to: hagedonm@u.library.arizona.edu
  send_all_feedback_to: wss.simpson@gmail.com 

I seem to be able to get the completion certificates without issue.

michaelhagedon commented 9 years ago

@simpsonw I won't know about spam until we put it in production. :-)

On this branch I was able to get mail on localhost sending through gmail.

simpsonw commented 9 years ago

@michaelhagedon I think I've figured out the problem. The issue is that the feedback email will fail if the tutorial in question doesn't have a contact_email associated with it. The behavior I was seeing didn't even give the user an error message; the form simply appeared to do nothing after you clicked submit. The culprit is the call to addBcc on line 933 of the TutorialsController. If you don't have a contact_email specified, it gets passed an empty string and then fails, but since it's outside of the try/catch block that send the success/failure message back to the browser, you don't have any idea what's going on.

Seeing as how this field is optional/nullable in the database, I think we should probably check to make sure it's not empty before sending the email.

simpsonw commented 9 years ago

Since the bug I was talking about previously doesn't really seem to have anything directly to do with this pull request, I've decided to make a separate issue (#115) to deal with it. I will manually fixed the merge issue, review it, and commit/merge as appropriate.

simpsonw commented 9 years ago

FYI, this has been deployed to the UAL production server.