diff --git a/app/controllers/redmine_oauth_controller.rb b/app/controllers/redmine_oauth_controller.rb index c898914..65d79ca 100644 --- a/app/controllers/redmine_oauth_controller.rb +++ b/app/controllers/redmine_oauth_controller.rb @@ -66,7 +66,7 @@ def try_to_login info user = User.joins(:email_addresses).where(:email_addresses => { :address => info["email"] }).first_or_create if user.new_record? # Self-registration off - redirect_to(home_url) && return unless Setting.self_registration? + redirect_to(home_url) && return unless Setting.self_registration? || settings['ignore_self_registration'] # Create on the fly user.firstname = info["family_name"] user.lastname = info["given_name"] diff --git a/app/views/settings/_google_settings.html.erb b/app/views/settings/_google_settings.html.erb index 1a14763..5178109 100644 --- a/app/views/settings/_google_settings.html.erb +++ b/app/views/settings/_google_settings.html.erb @@ -14,3 +14,7 @@ <%= check_box_tag "settings[oauth_authentification]", true, @settings['oauth_authentification'] %>

+

+ + <%= check_box_tag "settings[ignore_self_registration]", true, @settings['ignore_self_registration'] %> +

diff --git a/init.rb b/init.rb index 26a073e..a3615df 100644 --- a/init.rb +++ b/init.rb @@ -13,6 +13,7 @@ :client_id => "", :client_secret => "", :oauth_autentification => false, - :allowed_domains => "" + :allowed_domains => "", + :ignore_self_registration => false }, :partial => 'settings/google_settings' end