Index: app/controllers/my_controller.rb =================================================================== --- app/controllers/my_controller.rb (revision 5505) +++ app/controllers/my_controller.rb (working copy) @@ -174,4 +174,24 @@ end render :nothing => true end + + def openid + if request.post? + if Setting.openid? && using_open_id? && User.current != User.anonymous + url = url_for :action => 'openid' + current_user = User.current + authenticate_with_open_id(params[:openid_url], :return_to => url) do |result, identity_url, registration| + self.logged_user = current_user + if result.successful? + current_user.identity_url = identity_url + current_user.save + redirect_to :action => 'account' + end + end + end + else + render :action => 'openid' + end + end + end Index: app/controllers/account_controller.rb =================================================================== --- app/controllers/account_controller.rb (revision 5505) +++ app/controllers/account_controller.rb (working copy) @@ -158,7 +158,7 @@ def open_id_authenticate(openid_url) - authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email], :return_to => signin_url) do |result, identity_url, registration| + authenticate_with_open_id(openid_url, :required => [:nickname, :fullname, :email, 'http://axschema.org/contact/email', 'http://axschema.org/namePerson/first', 'http://axschema.org/namePerson/last'], :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? @@ -166,12 +166,24 @@ 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? + login = registration['nickname'] + login = registration['email'] unless !login.nil? + login = registration['http://axschema.org/contact/email'][0] unless !login.nil? + + email = registration['email'] + email = registration['http://axschema.org/contact/email'][0] unless !email.nil? + + name = registration['fullname'] + + user.login = login + user.mail = email user.firstname, user.lastname = registration['fullname'].split(' ') unless registration['fullname'].nil? + user.firstname = registration['http://axschema.org/namePerson/first'][0] unless registration['http://axschema.org/namePerson/first'].nil? + user.lastname = registration['http://axschema.org/namePerson/last'][0] unless registration['http://axschema.org/namePerson/last'].nil? user.random_password user.register + logger.info user.inspect case Setting.self_registration when '1' register_by_email_activation(user) do Index: app/views/my/account.rhtml =================================================================== --- app/views/my/account.rhtml (revision 5505) +++ app/views/my/account.rhtml (working copy) @@ -16,8 +16,10 @@

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

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

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

+ <% if Setting.openid? %> -

<%= f.text_field :identity_url %>

+

<%= f.text_field :identity_url %> (<%= link_to l(:button_update), {:action => 'openid'}, :method => :post %>)

+ <% end %> <% @user.custom_field_values.select(&:editable?).each do |value| %> Index: app/views/account/login.rhtml =================================================================== --- app/views/account/login.rhtml (revision 5505) +++ app/views/account/login.rhtml (working copy) @@ -11,13 +11,7 @@ <%= password_field_tag 'password', nil, :tabindex => '2' %> -<% if Setting.openid? %> - - <%= text_field_tag "openid_url", nil, :tabindex => '3' %> - -<% end %> - <% if Setting.autologin? %> @@ -38,5 +32,11 @@ <%= javascript_tag "Form.Element.focus('username');" %> <% end %> + +<% if Setting.openid? %> + <%= render :partial => 'account/openid', :locals => { :controller => 'account', :action => 'login' } %> +<% end %> + + <%= call_hook :view_account_login_bottom %> Index: config/locales/en.yml =================================================================== --- config/locales/en.yml (revision 5505) +++ config/locales/en.yml (working copy) @@ -811,6 +811,7 @@ label_issues_visibility_all: All issues label_issues_visibility_public: All non private issues label_issues_visibility_own: Issues created by or assigned to the user + label_openid: OpenID Settings button_login: Login button_submit: Submit @@ -932,7 +933,10 @@ text_zoom_in: Zoom in text_zoom_out: Zoom out text_warn_on_leaving_unsaved: "The current page contains unsaved text that will be lost if you leave this page." - + text_openid_legend: Sign-in with OpenID + text_openid_provider: "Please click your account provider:" + text_openid_noscript: "OpenID is service that allows you to log-on to many different websites using a single identity. Find out more about OpenID and how to get an OpenID enabled account." + default_role_manager: Manager default_role_developer: Developer default_role_reporter: Reporter