diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-08-30 15:35:25 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-08-30 15:35:25 +0100 |
commit | 9c7799903ccf5551df496b7a57e564808089ed30 (patch) | |
tree | 2d71f55483cd66b926397f89efcef4dbcb3adaf4 /app/controllers/user_controller.rb | |
parent | 0420098e50996a033552335e94e35ade781357af (diff) | |
parent | a2817f8877a5e37962f81dd96f5ef79ad4a6b0c4 (diff) |
Merge branch 'feature/add-recaptcha' into develop
Diffstat (limited to 'app/controllers/user_controller.rb')
-rw-r--r-- | app/controllers/user_controller.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 8e4fb29ef..6916b4456 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -71,7 +71,7 @@ class UserController < ApplicationController # Login form def signin work_out_post_redirect - + @request_from_foreign_country = country_from_ip != MySociety::Config.get('ISO_COUNTRY_CODE', 'GB') # make sure we have cookies if session.instance_variable_get(:@dbman) if not session.instance_variable_get(:@dbman).instance_variable_get(:@original) @@ -118,10 +118,15 @@ class UserController < ApplicationController # Create new account form def signup work_out_post_redirect - + @request_from_foreign_country = country_from_ip != MySociety::Config.get('ISO_COUNTRY_CODE', 'GB') # Make the user and try to save it @user_signup = User.new(params[:user_signup]) - if !@user_signup.valid? + error = false + if @request_from_foreign_country && !verify_recaptcha + flash.now[:error] = _("There was an error with the words you entered, please try again.") + error = true + end + if error || !@user_signup.valid? # Show the form render :action => 'sign' else |