Patch #5966
closed
change to allow openID to use Google Apps
Added by Chris Mague about 14 years ago.
Updated over 2 years ago.
Description
diff -r ./config/environment.rb /home/chris/tmp/redmine/them/redmine-1.0.0/config/environment.rb
61,62d60
<
< require 'gapps_openid'
diff -r ./app/controllers/account_controller.rb /home/chris/tmp/redmine/them/redmine-1.0.0/app/controllers/account_controller.rb
161,164c161
< r = authenticate_with_open_id(openid_url, :required => ["http://schema.openid.net/contact/email"], :return_to => signin_url) do |result, identity_url, registration|
< logger.warn "Failed login because: '#{result.inspect} at #{Time.now.utc}"
< logger.warn "Failed login because: '#{result} at #{Time.now.utc}"
< logger.warn "Failed login because: '#{result.message} at #{Time.now.utc}"
---
> authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration|
166,170c163
< logger.warn "identity_url: '#{identity_url} at #{Time.now.utc}"
< logger.warn "registration: '#{registration.inspect} at #{Time.now.utc}"
< #user = User.find_or_initialize_by_identity_url(identity_url)
< logger.warn "registration: '#{registration["http://schema.openid.net/contact/email"][0]}'"
< user = User.find_by_mail(registration["http://schema.openid.net/contact/email"][0])
---
> user = User.find_or_initialize_by_identity_url(identity_url)
Just wrapped the description in pre
tags.
- Category set to Accounts / authentication
Google OpenID does not work for me under versions 1.0.1 and 1.1.2... I have investigated a little this issue and found that changing the open_id_authenticate
function to the following code helps (includes more attributes than Chris' patch):
def open_id_authenticate(openid_url)
authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email,
'http://axschema.org/namePerson/first', 'http://axschema.org/namePerson/last', 'http://axschema.org/contact/email'
], :return_to => signin_url) do |result, identity_url, registration|
if result.successful?
user = User.find_or_initialize_by_identity_url(identity_url)
if user.new_record?
# Self-registration off
redirect_to(home_url) && return unless Setting.self_registration?
# Create on the fly
user.login = registration['nickname'] unless registration['nickname'].nil?
user.mail = registration['email'] unless registration['email'].nil?
user.firstname, user.lastname = registration['fullname'].split(' ') unless registration['fullname'].nil?
user.login = registration['http://axschema.org/contact/email'].first unless registration['http://axschema.org/contact/email'].nil?
user.mail = registration['http://axschema.org/contact/email'].first unless registration['http://axschema.org/contact/email'].nil?
user.firstname = registration['http://axschema.org/namePerson/first'].first unless registration['http://axschema.org/namePerson/first'].nil?
user.lastname = registration['http://axschema.org/namePerson/last'].first unless registration['http://axschema.org/namePerson/last'].nil?
user.random_password
user.register
case Setting.self_registration
when '1'
register_by_email_activation(user) do
onthefly_creation_failed(user)
end
when '3'
register_automatically(user) do
onthefly_creation_failed(user)
end
else
register_manually_by_administrator(user) do
onthefly_creation_failed(user)
end
end
else
# Existing record
if user.active?
successful_authentication(user)
else
account_pending
end
end
end
end
end
See also:
Unless I missed something it looks like Google OpenID does not work at all in Redmine!
- Category changed from Accounts / authentication to OpenID
- % Done changed from 0 to 100
- Status changed from New to Closed
The OpenID support has been dropped by #35755 for the upcoming Redmine 5.0.0.
Also available in: Atom
PDF