Project

General

Profile

OpenID support: "login can't be blank"

Added by Anonymous over 13 years ago

Hi there,
I'm running Redmine 1.1.0 and have OpenID support enabled. However, I'm not able to get it to actually log in with an OpenID. I've tried a Google Account and others have used Ubuntu Launchpad accounts.

The symptom is that I get the following error:

Login can't be blank
Firstname can't be blank
Lastname can't be blank
Email can't be blank
Email is invalid

On that screen, the specified OpenID URL is correctly filled out, but it's not possible to continue without providing a username, password, email, first name, last name, etc. - which kind of defeats the purpose of OpenID :)

I have the Ruby OpenID gem installed and running.

I'd appreciate any pointers.

Many thanks.


Replies (4)

RE: OpenID support: "login can't be blank" - Added by Ben Cochran over 13 years ago

I agree that the current support is a little wonky having just tried it out.

The OpenID register process should auto-register you with the site and ask for email, first and last name via the OpenID request. If the auth server does not provide that information, redirect to a form similar to the one mentioned above which only asks for the missing information. I know at the very least the google OpenID URL provides this information.

RE: OpenID support: "login can't be blank" - Added by Andriy Lesyuk over 13 years ago

Getting the same running on 1.0.5 and 1.1.2... Using Google! :(

RE: OpenID support: "login can't be blank" - Added by Andriy Lesyuk over 13 years ago

I think I know what's wrong... Here is URL to Google:

https://www.google.com/accounts/o8/ud?
  openid.assoc_handle=***********&
  openid.ax.mode=fetch_request&
  openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&
  openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&
  openid.mode=checkid_setup&
  openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&
  openid.ns.ax=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0&
  openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&
  openid.realm=http%3A%2F%2Fdev.redmine.test%2F&
  openid.return_to=http%3A%2F%2Fdev.redmine.test%2Flogin%3F_method%3Dpost%26open_id_complete%3D1&
  openid.sreg.required=nickname%2Cfullname%2Cemail

Accordingly to Google there should be openid.ax.required instead of openid.sreg.required...

See also: http://projects.andriylesyuk.com/issues/1717

RE: OpenID support: "login can't be blank" - Added by Andriy Lesyuk over 13 years ago

Ok... I found that changing the open_id_authenticate function to the following helps:

  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?
        logger.info " >>> registration: #{registration.inspect}" # FIXME
        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

    (1-4/4)