diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb
index be6640d..9407463 100644
--- a/app/controllers/public/account_controller.rb
+++ b/app/controllers/public/account_controller.rb
@@ -189,6 +189,11 @@ class AccountController < ApplicationController
if request.post?
begin
+ unless verify_recaptcha
+ @change_password.errors.add(:base, _('Please type the captcha text correctly'))
+ return false
+ end
+
requestors = fetch_requestors(params[:value])
raise ActiveRecord::RecordNotFound if requestors.blank? || params[:value].blank?
diff --git a/app/views/account/forgot_password.html.erb b/app/views/account/forgot_password.html.erb
index 3975daf..bbe6cda 100644
--- a/app/views/account/forgot_password.html.erb
+++ b/app/views/account/forgot_password.html.erb
@@ -5,6 +5,9 @@
<%= form_tag do %>
<%= labelled_form_field fields_label, text_field_tag(:value) %>
+
<%= _('Please type the captcha text below') %>
+ <%= recaptcha_tags(:display => { :theme => 'clean' }, :ajax => true) %>
+
<% button_bar do %>
<%= submit_button('send', _('Send instructions')) %>
diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb
index 4d634fb..ecfb90a 100644
--- a/test/functional/account_controller_test.rb
+++ b/test/functional/account_controller_test.rb
@@ -236,6 +236,16 @@ class AccountControllerTest < ActionController::TestCase
assert_template 'password_recovery_sent'
end
+ should 'not respond to forgotten password change if captcha verification fails' do
+ create_user('test')
+ @controller.stubs(:verify_recaptcha).returns(false)
+ post :forgot_password, :value => 'test'
+ change = assigns(:change_password)
+ assert change.errors.has_key?(:base)
+ assert_response :success
+ assert_tag :tag => 'div', :attributes => { :id => 'errorExplanation', :class => 'errorExplanation' }
+ end
+
should 'respond to forgotten password change request with email' do
change = ChangePassword.new
create_user('test', :email => 'test@localhost.localdomain')
--
libgit2 0.21.2