Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ignoring of the self_registration setting #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/redmine_oauth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def try_to_login info
user = User.find_or_initialize_by_mail(info["email"])
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, user.lastname = info["name"].split(' ') unless info['name'].nil?
user.firstname ||= info[:given_name]
Expand Down
4 changes: 4 additions & 0 deletions app/views/settings/_google_settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
<label>Oauth authentification:</label>
<%= check_box_tag "settings[oauth_authentification]", true, @settings[:oauth_authentification] %>
</p>
<p>
<label>Ignore Self-registration setting:</label>
<%= check_box_tag "settings[ignore_self_registration]", true, @settings[:ignore_self_registration] %>
</p>
3 changes: 2 additions & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
:client_id => "",
:client_secret => "",
:oauth_autentification => false,
:allowed_domains => ""
:allowed_domains => "",
:ignore_self_registration => ""
}, :partial => 'settings/google_settings'
end