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

Registration error when used in conjunction with authlogic_openid #1

Open
omarkarim opened this issue Jul 31, 2009 · 10 comments
Open

Comments

@omarkarim
Copy link

Hello,

I'm getting an ActionController::DoubleRenderError when using authlogic_oauth to register a user with authlogic_openid also installed. The user is being saved in a block as recommended: @user.save do |result| etc...

At first glance it seems the save method could be the culprit since it's being overridden by both authlogic_openid and authlogic_oauth? Any help would be greatly appreciated.

Thanks!

@jrallison
Copy link
Owner

Truthfully, I've never tested authlogic_openid and authlogic_oauth in the same project, so that very well may be the case.

Can you post the contents of the controller action where the error is occurring? Just to give me a starting point.

Thanks!

@omarkarim
Copy link
Author

Thanks very much for taking a look at this. I have a fairly typical authlogic UsersController with the following create action:

def create
@user = User.new(params[:user])
@user.save do |result|
if result
flash[:notice] = "Registration successful."
redirect_to root_url
else
render :action => 'new'
end
end
end

@jrallison
Copy link
Owner

Looks like you're spot on here. Unfortunately, I don't see an easy fix for this. I've sent an email to Ben at binarylogic (who developed authlogic and authlogic_openid) to see if he has any ideas.

For now, it looks like the two are incompatible. I'll update here if the situation improves.

@omarkarim
Copy link
Author

Ok great, thanks! Meanwhile, is there an option for auto-registering the user if s/he does not exist in the database when logging in for the first time? That way my UserSessionsController could cover both the login and register workflows.

@jrallison
Copy link
Owner

Not currently.

The downside to that is there wouldn't be anyway to capture other information from the user (such as any other required fields on the registration page).

I could add an option which allows that for the case where you only want to require the oauth token/secret for each user.

@moedusa
Copy link

moedusa commented Oct 12, 2009

Hello,

Having this option would be really nice. I am trying to figure out how to make it in my controller for an hour already with no luck :( - and yes, controller is that simple, and no required fields upon user exist... Seemed to be a dead simple task at the first glance...

@bfolkens
Copy link

bfolkens commented Dec 8, 2009

FWIW I got around this with something like:


@user = User.new(params[:user])
result = @user.save
return if @performed_render || @performed_redirect
    
if result
  ...
else
  ...
end

and I'm using OAuth, OpenID, and Facebook...

@dapi
Copy link

dapi commented Dec 20, 2009

bfoklens, your solution works for me. But it's require to password confirmation until registration for last added gem plugin (oid or oauth). First plugin works fine, but second requires passwords.

Could you present full example of code?

@bfolkens
Copy link

dapi: I filed a bug report here http://github.com/jrallison/authlogic_oauth/issues#issue/5 regarding that issue (with a patch if you're interested). The authlogic OpenID code has a similar issue (probably why this one does since it seems like it's based on that) so I posted a bug report and patch on that issue tracker as well.

@dapi
Copy link

dapi commented Dec 20, 2009

That patch works for me fine.

I found yet another way to fix it:

class User < ActiveRecord::Base
 def require_password?
  return false if using_openid? || using_oauth?
  super
 end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants