-
Notifications
You must be signed in to change notification settings - Fork 11
Handle session validation errors when user model has :active attribute, :default => false #25
Comments
Hi @badnaam, I believe you are hitting the error because automatic registration is disabled, and you are attempting to login with an account that has not been registered yet. Did you intend to have auto-registration disabled? What does your UserSession class definition look like? The basic setup should be like the following, but you may also have "auto_register false" specified.
With autoregistration enabled, the account login should proceed correctly (still does for me in the sample). However, if you have auto-registration disabled, you must provide the necessary registration logic to setup the account in the first place. Is that any help? |
Tardate, thanks. I do have rpx_key ENV['RPX_KEY'] Here are my files if you wanna take a look. Thanks for your help! |
Oh, I did verify that by the time the session is created and saved the user is registered and there is a slug generated for the user, so the user record should be there, unless UserSession does not know how to work with slugs. Just a hypothesis the slugs may not have anything to do with it. This usually happens only in the create method in UserSession i,e. when the session is created, but if I ignore the error and continue with the session it seems there is in fact a current_user in subsequent pages. |
Hi badnaam, |
Same here. Trying to introduce authlogic_rpx to an existing project, getting "UserSession: no credentials provided" after all redirects :( |
I've found how to reproduce error: rails-authlogic-rpx-sample, add field ':active, :boolean, :default => true' to User model. |
hi @ql, tried to reproduce the error but haven't been able to yet. I added users.active to the rails 2.3.5 version of the sample at http://github.com/tardate/rails-authlogic-rpx-sample/tree/gh25_session_error_investigation and I haven't hit the UserSession: no credentials provided error. I tried also with rails3, see http://github.com/tardate/rails-authlogic-rpx-sample/tree/gh25_session_error_investigation_rails3 and also no immediate problem. Could you take a look and see if there's anything else that's required to cause the error? Do you have a validation on :active or something else like that |
Hi! Only reason why I call this thing "a bug" is that error message was "Authentication failed. Please try again.", not informing inactive user. Could take time for finding out the problem's source |
ahah, thanks for figuring that out! agree, should provide some smarter handling of this situation. I'll make that a 'todo' |
I implemented the instructions in the sample app and docs. It seems when I try to login (using a gmail account) I get the following error while trying to save the @user_session, in UserSessionsController => create action. I know that the login information is correct and in fact the @rpx_data object contains some legit profile info, the rpx pop up seems to think it worked, but I get a failure. Also, in my janrain dashboard I see the login counts getting recorded.
Here is teh link to the key source file
http://pastie.org/1040188
In addition to this, the other thing I see is that @attempted_record is nil in the create action as well.
<Authlogic::Session::Validation::Errors:0x7f0aa1315c60 @errors=#<OrderedHash {"base"=>[#<ActiveRecord::Error:0x7f0aa12f8458 @options={}, @Attribute=:base, @message="We did not find any accounts with that login. Enter your details and create an account.", @base=#<UserSession: no credentials provided>, @type="We did not find any accounts with that login. Enter your details and create an account.">]}>, @base=#<UserSession: no credentials provided>>
The text was updated successfully, but these errors were encountered: