myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [3038] trunk/app/controllers/users_controller.rb:


From: noreply
Subject: [myexperiment-hackers] [3038] trunk/app/controllers/users_controller.rb: more user control
Date: Mon, 18 Jun 2012 12:43:29 +0000 (UTC)

Revision
3038
Author
dgc
Date
2012-06-18 12:43:28 +0000 (Mon, 18 Jun 2012)

Log Message

more user control

Modified Paths

Diff

Modified: trunk/app/controllers/users_controller.rb (3037 => 3038)


--- trunk/app/controllers/users_controller.rb	2012-06-18 11:12:58 UTC (rev 3037)
+++ trunk/app/controllers/users_controller.rb	2012-06-18 12:43:28 UTC (rev 3038)
@@ -3,6 +3,8 @@
 # Copyright (c) 2007 University of Manchester and the University of Southampton.
 # See license.txt for details.
 
+require 'open-uri'
+
 class UsersController < ApplicationController
 
   contributable_actions = [:workflows, :files, :packs, :blogs]
@@ -176,18 +178,34 @@
     respond_to do |format|
 
       sent_email = false
+      spammer = false
 
       if @user.valid?
+
+        # basic spam check
+
+        url = ""
+
+        sfs_response = ActiveSupport::JSON.decode(open(url).read)
+
+        if (sfs_response["success"] == 1)
+          if ((sfs_response["email"]["appears"] == 1) || (sfs_response["ip"]["appears"] == 1))
+            spammer = true
+          end
+        end
+
         begin
             # DO NOT log in user yet, since account needs to be validated and activated first (through email).
-            @user.send_email_confirmation_email
-            sent_email = true
+            if !spammer
+              @user.send_email_confirmation_email
+              sent_email = true
+            end
         rescue
           @user.errors.add_to_base("Unable to send confirmation email")
         end
       end
 
-      if sent_email && @user.save
+      if sent_email && !spammer && @user.save
         
         # If required, copy the email address to the Profile
         if params[:make_email_public]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]