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 @@