Update captcha validate in registration.

atratsevskiy
Чистяков Илья 15 years ago
parent 4c496168ae
commit 941c60f1e7

@ -1,4 +1,4 @@
AUX 10_redmine_vhost.conf 523 RMD160 080c5afc8cef54f2fbdf24b1ff262cc155d85ac5 SHA1 cac48370ffc7756173c0a759366ee8a7d3d7c716 SHA256 439017a65fabb0bd7cb49abd94864be372b73a4b953e31dc0db8449790406205
AUX openid.patch 11278 RMD160 3e929f06b1673a065b54ec75e985c4f9bd32aa8d SHA1 972caf27355c2a057126d53ad0116a35b840faae SHA256 3796111fb32851311515e53fc0f0f1d098d9d4de92adc054dd5ed3b54cec61be
AUX simple_captcha.patch 2214 RMD160 40b90ed2a0e0711e164bf4efd783b94386a6204a SHA1 b50d01b37b8eeb143ce1b852048d82e215a9eb43 SHA256 2c6d6fd33a611e95641b0e6618eb243ebff7e4560da13342b0968d635fb41d73
AUX simple_captcha.patch 2896 RMD160 76f88f3a2714d5624356710bff4c21c5356a8dcf SHA1 9334662cf2d66b63b3f7bfc78e4cc8d061a0b1b7 SHA256 f9d8aa8d98318b8b9331ce2226e974c7c433596a3d6c61f48971048e57865165
EBUILD redmine-9999.ebuild 5394 RMD160 b97cd4057fb045f388702af3b829a641f296705f SHA1 4eec25b74c1b18c723bb1be256cf176c106212ba SHA256 c6511d5a01e0152b2d756c9f1c7827ddec5784486e1cded5dfa441a26e9c0232

@ -30,17 +30,39 @@
def simple_captcha_value(key = simple_captcha_key) #:nodoc
--- app/controllers/account_controller.rb
+++ app/controllers/account_controller.rb
@@ -92,7 +92,9 @@ class AccountController < ApplicationController
@@ -92,6 +92,7 @@ class AccountController < ApplicationController
@user = User.new(params[:user])
@user.admin = false
@user.status = User::STATUS_REGISTERED
- if session[:auth_source_registration]
+ if !simple_captcha_valid?
+ flash.now[:error] = l(:notice_account_invalid_captcha)
+ elsif session[:auth_source_registration]
+ captcha_valid = simple_captcha_valid?
if session[:auth_source_registration]
@user.status = User::STATUS_ACTIVE
@user.login = session[:auth_source_registration][:login]
@user.auth_source_id = session[:auth_source_registration][:auth_source_id]
@@ -106,13 +107,18 @@ class AccountController < ApplicationController
@user.login = params[:user][:login]
@user.password, @user.password_confirmation = params[:password], params[:password_confirmation]
- case Setting.self_registration
- when '1'
- register_by_email_activation(@user)
- when '3'
- register_automatically(@user)
+ if !captcha_valid
+ @user.valid?
+ @user.errors.add :base, l(:notice_account_invalid_captcha)
else
- register_manually_by_administrator(@user)
+ case Setting.self_registration
+ when '1'
+ register_by_email_activation(@user)
+ when '3'
+ register_automatically(@user)
+ else
+ register_manually_by_administrator(@user)
+ end
end
end
end
--- app/views/account/register.rhtml
+++ app/views/account/register.rhtml
@@ -37,6 +37,9 @@

Loading…
Cancel
Save