pax_global_header00006660000000000000000000000064150105274150014512gustar00rootroot0000000000000052 comment=340f9f300d66141a784ccd7aa30b9d8451ce8d97 redmine_simple_captcha-1.0/000077500000000000000000000000001501052741500160315ustar00rootroot00000000000000redmine_simple_captcha-1.0/CHANGELOG000066400000000000000000000000321501052741500172360ustar00rootroot00000000000000v1.0 • Initial release. redmine_simple_captcha-1.0/Gemfile000066400000000000000000000003621501052741500173250ustar00rootroot00000000000000# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2025 Soren Stoutner # # This file is part of Redmine Simple Captcha. # See LICENSE for more information. redmine_simple_captcha-1.0/LICENSE000066400000000000000000000036661501052741500170510ustar00rootroot00000000000000SPDX-License-Identifier: MIT SPDX-FileCopyrightText: 2025 Soren Stoutner This file is part of Redmine Simple Captcha, which is a fork of Redmine Stupid Captcha developed by Mehdi ABAAKOUK. At the time of the fork on 16 April 2025, the last commit to Redmine Stupid Captcha was on 17 November 2015. Redmine Stupid Captcha was released under the MIT license, but the repository contains no copyright information. https://github.com/sileht/redmine-stupid-captcha On 2 July 2013, Christoph Dwertmann forked Redmine Simple Captcha to create the Recaptcha Redmine plugin and then modified it to use Google's reCAPTCHA. I took inspiration from some of his work to figure out how to make Redmine Simple Captcha compatible with Redmine >= 5.x. His work is released under the MIT license, but the repository contains no copyright information. https://github.com/cdwertmann/recaptcha MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the " Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. redmine_simple_captcha-1.0/README.md000066400000000000000000000017421501052741500173140ustar00rootroot00000000000000Simple CAPTCHA Redmine plugin ============================= This Redmine plugin adds a very simple CAPTCHA question and answer to the account registration page. The question and answer are the same for all people attempting to register on your site, and only allows registration for someone who fills out the CAPTCHA answer field with the same value you set in the plugin settings. For example, you can set the CAPTCHA question to be a mathamatical equation requesting the user type the answer. Or, you can set it to be a logical puzzle. You can even instruct the user to simply type a specific word in the answer. Obviously, this will not prevent sophisticated registration attacks. But it gets rid of the low-hanging fruit of automatic registrations, particularly those who just want to flood a target email address with spam. - Installation: Install to your plugins directory and restart Redmine. - Configuration: On the plugin setting page, create your CAPTCHA question and answer. redmine_simple_captcha-1.0/app/000077500000000000000000000000001501052741500166115ustar00rootroot00000000000000redmine_simple_captcha-1.0/app/views/000077500000000000000000000000001501052741500177465ustar00rootroot00000000000000redmine_simple_captcha-1.0/app/views/account/000077500000000000000000000000001501052741500214025ustar00rootroot00000000000000redmine_simple_captcha-1.0/app/views/account/register.html.erb000066400000000000000000000027331501052741500246700ustar00rootroot00000000000000

<%=l(:label_register)%>

<%= labelled_form_for @user, :url => register_path do |f| %> <%= error_messages_for 'user' %>
<% if @user.auth_source_id.nil? %>

<%= f.text_field :login, :size => 25, :required => true %>

<%= f.password_field :password, :size => 25, :required => true %> <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>

<%= f.password_field :password_confirmation, :size => 25, :required => true %>

<% end %>

<%= f.text_field :firstname, :required => true %>

<%= f.text_field :lastname, :required => true %>

<%= f.text_field :mail, :required => true %>

<%= f.select :language, lang_options_for_select %>

<% @user.custom_field_values.select {|v| v.editable? || v.required?}.each do |value| %>

<%= custom_field_tag_with_label :user, value %>

<% end %>

<%= Setting.plugin_redmine_simple_captcha['simple_captcha_question'] %>

<%= f.text_field :simple_captcha_answer, :required => true %>

<%= submit_tag l(:button_submit) %> <% end %> redmine_simple_captcha-1.0/app/views/settings/000077500000000000000000000000001501052741500216065ustar00rootroot00000000000000redmine_simple_captcha-1.0/app/views/settings/_settings.html.erb000066400000000000000000000012171501052741500252430ustar00rootroot00000000000000
Plugin Settings

Set the CAPTCHA question and the expected answer.

<%= text_field_tag 'settings[simple_captcha_question]', settings['simple_captcha_question'] %>

<%= text_field_tag 'settings[simple_captcha_answer]', settings['simple_captcha_answer'] %>

redmine_simple_captcha-1.0/config/000077500000000000000000000000001501052741500172765ustar00rootroot00000000000000redmine_simple_captcha-1.0/config/locales/000077500000000000000000000000001501052741500207205ustar00rootroot00000000000000redmine_simple_captcha-1.0/config/locales/en.yml000066400000000000000000000005431501052741500220470ustar00rootroot00000000000000# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2025 Soren Stoutner # # This file is part of Redmine Simple Captcha. # See LICENSE for more information. en: field_simple_captcha_answer: CAPTCHA Answer field_simple_captcha_question: CAPTCHA Question redmine_simple_captcha-1.0/init.rb000066400000000000000000000014641501052741500173260ustar00rootroot00000000000000# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2025 Soren Stoutner # # This file is part of Redmine Simple Captcha. # See LICENSE for more information. require_relative './lib/account_controller_patch' require_relative './lib/user_patch' Redmine::Plugin.register :redmine_simple_captcha do name 'Simple CAPTCHA' author 'Soren Stoutner' description 'Adds a very simple captcha to the account registration page.' version '1.0' url 'https://github.com/sorenstoutner/redmine_simple_captcha' author_url 'https://github.com/sorenstoutner' settings({ :partial => 'settings/settings', :default => { 'simple_captcha_question' => 'CHANGE ME', 'simple_captcha_answer' => 'CHANGE ME', } }) end redmine_simple_captcha-1.0/lib/000077500000000000000000000000001501052741500165775ustar00rootroot00000000000000redmine_simple_captcha-1.0/lib/account_controller_patch.rb000066400000000000000000000041761501052741500242120ustar00rootroot00000000000000# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2025 Soren Stoutner # # This file is part of Redmine Simple Captcha. # See LICENSE for more information. module AccountControllerPatch def self.included(base) base.class_eval do def register (redirect_to(home_url); return) unless Setting.self_registration? || session[:auth_source_registration] if request.get? session[:auth_source_registration] = nil @user = User.new(:language => current_language.to_s) else user_params = params[:user] || {} @user = User.new @user.safe_attributes = user_params @user.admin = false @user.register if session[:auth_source_registration] @user.activate @user.login = session[:auth_source_registration][:login] @user.auth_source_id = session[:auth_source_registration][:auth_source_id] if @user.save session[:auth_source_registration] = nil self.logged_user = @user flash[:notice] = l(:notice_account_activated) redirect_to my_account_path end else @user.login = params[:user][:login] unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank? @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation] end if user_params[:simple_captcha_answer] == Setting.plugin_redmine_simple_captcha['simple_captcha_answer'] case Setting.self_registration when '1' register_by_email_activation(@user) when '3' register_automatically(@user) else register_manually_by_administrator(@user) end else flash.delete(:simple_captcha_error) end end end end end end end AccountController.send(:include, AccountControllerPatch) redmine_simple_captcha-1.0/lib/user_patch.rb000066400000000000000000000010271501052741500212610ustar00rootroot00000000000000# SPDX-License-Identifier: MIT # SPDX-FileCopyrightText: 2025 Soren Stoutner # # This file is part of Redmine Simple Captcha. # See LICENSE for more information. require_dependency 'project' require_dependency 'principal' require_dependency 'user' module UserPatch def self.included(base) base.send(:include, InstanceMethods) end module InstanceMethods def simple_captcha_answer nil end end end User.send(:include, UserPatch)