Add captcha in register.

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

@ -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 1126 RMD160 a5316ed4d9b057eb4b6388c7cd0b4cd5d4d6f990 SHA1 ae8c7b66e6da4240bfae350826742636a1afa31a SHA256 b8e0f65c7ea2743a1c5cdd5e762f7b191a6ea0e9d499ed98c6d2479d3edb5027
EBUILD redmine-9999.ebuild 5224 RMD160 5d3b7a17e5dc6c56deaf5a99ee120f8e8602e903 SHA1 5c68a4d77ec0f14da5d58ae599fdae7039f3432b SHA256 5f54868ea9bc1823612cc90c75ed54376fdd9227e9de609e0166d397a9c58cb6
AUX simple_captcha.patch 2214 RMD160 40b90ed2a0e0711e164bf4efd783b94386a6204a SHA1 b50d01b37b8eeb143ce1b852048d82e215a9eb43 SHA256 2c6d6fd33a611e95641b0e6618eb243ebff7e4560da13342b0968d635fb41d73
EBUILD redmine-9999.ebuild 5394 RMD160 b97cd4057fb045f388702af3b829a641f296705f SHA1 4eec25b74c1b18c723bb1be256cf176c106212ba SHA256 c6511d5a01e0152b2d756c9f1c7827ddec5784486e1cded5dfa441a26e9c0232

@ -28,3 +28,28 @@
end
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
@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]
@user.status = User::STATUS_ACTIVE
@user.login = session[:auth_source_registration][:login]
@user.auth_source_id = session[:auth_source_registration][:auth_source_id]
--- app/views/account/register.rhtml
+++ app/views/account/register.rhtml
@@ -37,6 +37,9 @@
<% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
+
+<p><span><label for="captcha"><%=l(:field_captcha_valid)%> <span class="required">*</span></label>
+<%= show_simple_captcha(:label => '') %></span></p>
<!--[eoform:user]-->
</div>

@ -128,8 +128,15 @@ pkg_config() {
einfo "Install packs special OpenID and Simple Captcha:"
ruby script/plugin install svn://rubyforge.org/var/svn/expressica/plugins/simple_captcha || die
rake simple_captcha:setup || die
patch -p0 -i simple_captcha.patch || die
patch -p0 -i openid.patch || die
patch --dry-run -p0 >/dev/null < simple_captcha.patch
if [ $? = 0 ] ; then
patch -p0 -N -i simple_captcha.patch || die
fi
patch --dry-run -p0 >/dev/null < openid.patch
if [ $? = 0 ] ; then
patch -p0 -N -i openid.patch || die
fi
fi
if [ -e "${REDMINE_DIR}/config/initializers/session_store.rb" ] ; then
@ -140,7 +147,7 @@ pkg_config() {
einfo "Migrate database."
RAILS_ENV="${RAILS_ENV}" rake db:migrate || die
einfo "Upgrade the plugin migrations."
RAILS_ENV="${RAILS_ENV}" rake db:migrate:upgrade_plugin_migrations || die
#RAILS_ENV="${RAILS_ENV}" rake db:migrate:upgrade_plugin_migrations || die
RAILS_ENV="${RAILS_ENV}" rake db:migrate_plugins || die
einfo "Clear the cache and the existing sessions."
rake tmp:cache:clear || die

Loading…
Cancel
Save