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 backward compatibility code for :email_addresses #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion app/controllers/redmine_oauth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def oauth_google_callback
def try_to_login info
params[:back_url] = session[:back_url]
session.delete(:back_url)
user = User.joins(:email_addresses).where(:email_addresses => { :address => info["email"] }).first_or_create
if User.method_defined?(:email_addresses)
user = User.joins(:email_addresses).where(:email_addresses => { :address => info["email"] }).first_or_create
else
user = User.find_or_initialize_by(:mail => info["email"])
end
if user.new_record?
# Self-registration off
redirect_to(home_url) && return unless Setting.self_registration?
Expand Down