myexperiment-hackers
[Top][All Lists]
Advanced

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

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


From: noreply
Subject: [myexperiment-hackers] [3033] trunk/app/controllers/users_controller.rb: improved user registration form when unable to send confirmation email
Date: Sun, 17 Jun 2012 07:15:15 +0000 (UTC)

Revision
3033
Author
dgc
Date
2012-06-17 07:15:14 +0000 (Sun, 17 Jun 2012)

Log Message

improved user registration form when unable to send confirmation email

Modified Paths

Diff

Modified: trunk/app/controllers/users_controller.rb (3032 => 3033)


--- trunk/app/controllers/users_controller.rb	2012-06-15 15:00:29 UTC (rev 3032)
+++ trunk/app/controllers/users_controller.rb	2012-06-17 07:15:14 UTC (rev 3033)
@@ -174,9 +174,20 @@
     @user = User.new(params[:user])
     
     respond_to do |format|
-      if @user.save
-        # DO NOT log in user yet, since account needs to be validated and activated first (through email).
-        @user.send_email_confirmation_email
+
+      sent_email = false
+
+      if @user.valid?
+        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
+        rescue
+          @user.errors.add_to_base("Unable to send confirmation email")
+        end
+      end
+
+      if sent_email && @user.save
         
         # If required, copy the email address to the Profile
         if params[:make_email_public]
@@ -195,7 +206,7 @@
           }
         end
         
-        flash[:notice] = "Thank you for registering! We have sent a confirmation email to address@hidden with instructions on how to activate your account."
+        flash[:notice] = "Thank you for registering! An email has been sent to address@hidden with instructions on how to activate your account."
         format.html { redirect_to(:action ="" "index") }
       else
         format.html { render :action ="" "new" }

reply via email to

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