Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Cool - it seems to be working with Rails 2.3.2

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Hey, guys.

I was working with restful_athentication in Rails 2.2, but today I updated to Rails 2.3, created new app, installed the plugin and run the tests with error :

./test/functional/users_controller_test.rb:6: undefined method `fixtures' for main:Object (NoMethodError)
        from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
        from -e:1
        from -e:1:in `each'
        from -e:1

Thanks in advance.

343

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Is there a changelog for the Restful Authentication for changes since 9/05/08?  I have an existing plugin that's based on this code, and i'm interested in updating to the most current version.  There is stuff in the code that looks a bit wonky to me  ie: the permission_denied method in the AuthenticatedSystem module, and it looks like this has been completely removed in the new code.  Any help on the code/docs would be great.

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Anyone having this error:

NameError in Admin/controlsController#index

uninitialized constant Admin::ControlsController::LoggedException

/Users/areimann/rails/restful_authentication_tutorial/vendor/rails/activesupport

/lib/active_support/dependencies.rb:105:in `const_missing'
/Users/aaronr/rails/restful_authentication_tutorial/app/controllers/admin/controls_controller.rb:7:in `index'

This happens when I click on the "Admin" link on the main menu.

thanks

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

areimann wrote:

Anyone having this error:

NameError in Admin/controlsController#index

uninitialized constant Admin::ControlsController::LoggedException

/Users/areimann/rails/restful_authentication_tutorial/vendor/rails/activesupport

/lib/active_support/dependencies.rb:105:in `const_missing'
/Users/aaronr/rails/restful_authentication_tutorial/app/controllers/admin/controls_controller.rb:7:in `index'

This happens when I click on the "Admin" link on the main menu.

thanks

I'm also getting the same error!!
I'm running it on Rails 2.3 on InstantRails/Vista.
Has anyone solved this problem??

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

millisami wrote:
areimann wrote:

Anyone having this error:

NameError in Admin/controlsController#index

uninitialized constant Admin::ControlsController::LoggedException

/Users/areimann/rails/restful_authentication_tutorial/vendor/rails/activesupport

/lib/active_support/dependencies.rb:105:in `const_missing'
/Users/aaronr/rails/restful_authentication_tutorial/app/controllers/admin/controls_controller.rb:7:in `index'

This happens when I click on the "Admin" link on the main menu.

thanks

I'm also getting the same error!!
I'm running it on Rails 2.3 on InstantRails/Vista.
Has anyone solved this problem??

I didn't fix it, but I made the error go away.

Comment out this line in controles_controllers.rb (in the controlers/admin:
@exceptions = LoggedException.count

I would fix it if you are "going live" with this, but if you are just looking around (like I am), don't worry about fixing it, just comment it out.

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Hi all!!
Tell me please wherein sense of creating migrations for openID?
I look in page 13, but not understand why need tables for openID auth..
With this may changes openid identity in openID provider? or how?

Thanks a lot..
Sorry for my English

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Hi, excellent post! I've also stumbled across restful authentication and it really is good. However, I want to ask, is there a way to customize the default error messages (e.g 'Login has already been taken') ? Much appreciated for any help smile

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

sandiegoscott wrote:

After following instructions, and without making any modifications but those suggested in the instructions, I'm getting an "undefined method" error on the root page. Anybody seen this? Any clues?

================================

NoMethodError in Root#index

Showing app/views//index.html.erb where line #2 raised:

undefined method `authenticate' for #<Class:0xb6a016c4>

Extracted source (around line #2):

1: <% content_for :side do -%>   
2:     <% unless logged_in? -%><% if_in_beta? do -%>
3:         <%= error_messages_for :invitation %>
4:         <p>We are currently in private beta. Please enter your email address below and we will let know when an invitation becomes available.</p>
5:         <% uberform_for [:user, Invitation.new] do |f| -%>

RAILS_ROOT: /home/scott/tmp/restful_authentication_tutorial

Application Trace

vendor/rails/activerecord/lib/active_record/base.rb:1745:in `method_missing_without_paginate'
vendor/plugins/will_paginate/lib/will_paginate/finder.rb:164:in `method_missing'
lib/authenticated_system.rb:123:in `login_from_basic_auth'
lib/authenticated_system.rb:122:in `login_from_basic_auth'
lib/authenticated_system.rb:12:in `current_user'
lib/authenticated_system.rb:6:in `logged_in?'
(eval):2:in `send'
(eval):2:in `logged_in?'
app/views/root/index.html.erb:2
app/views/root/index.html.erb:1
app/controllers/root_controller.rb:5:in `index'

Full Trace

vendor/rails/activerecord/lib/active_record/base.rb:1745:in `method_missing_without_paginate'
vendor/plugins/will_paginate/lib/will_paginate/finder.rb:164:in `method_missing'
lib/authenticated_system.rb:123:in `login_from_basic_auth'
vendor/rails/actionpack/lib/action_controller/http_authentication.rb:95:in `call'
vendor/rails/actionpack/lib/action_controller/http_authentication.rb:95:in `authenticate'
vendor/rails/actionpack/lib/action_controller/http_authentication.rb:85:in `authenticate_with_http_basic'
lib/authenticated_system.rb:122:in `login_from_basic_auth'
lib/authenticated_system.rb:12:in `current_user'
lib/authenticated_system.rb:6:in `logged_in?'

... and much more

I'm having the same issues as this poster.  Any help would be greatly appreciated.

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

maryl, I suggest you go to http://www.buildingwebapps.com/podcasts … show_notes .They have screencast on how to implement user authentication using restful authentication smile

Last edited by acmecorps (2009-05-02 02:52:22)

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

areimann wrote:

Anyone having this error:

NameError in Admin/controlsController#index

uninitialized constant Admin::ControlsController::LoggedException

/Users/areimann/rails/restful_authentication_tutorial/vendor/rails/activesupport

/lib/active_support/dependencies.rb:105:in `const_missing'
/Users/aaronr/rails/restful_authentication_tutorial/app/controllers/admin/controls_controller.rb:7:in `index'

This happens when I click on the "Admin" link on the main menu.

It's because the ExceptionLogger plugin isn't installed, though it's required.  Why this is the case, I don't know.  But you need to install the plugin.  There are a few steps.

First, download the plugin.  Where you download the plugins in the default instructions, you also need to tell git to get the ExceptionLogger plugin.  Insert the second command here in in the process:

git submodule init
git submodule add git://github.com/defunkt/exception_logger.git vendor/plugins/exception_logger                       
git submodule update

Then finish the instructions given on page 1, upto and including rake db:migrate

Next, you need to integrate the plugin into the tutorial application.

Insert this line into /app/application_controller.rb, immediately below the other Include statements:

 include ExceptionLoggable

Now, tell ExceptionLogger to use the WillPaginte plugin.  Uncomment these three lines in vendor/plugins/exception_logger/init.rb
require 'will_paginate'
$PAGINATION_TYPE = 'will_paginate'
WillPaginate.enable

Finally, update config/routes.rb to include the paths for ExceptionLogger:
map.connect "logged_exceptions/:action/:id", :controller => "logged_exceptions"
map.resources :logged_exceptions

Yes, you need both lines.  Insert them immediately below the map.resources :members line.

Now, start (or restart) WEBrick and your application should be working.  There's no need to run a generator or migration for ExceptionLogger as it's already included in the tutorial code.

Neil.

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Hmmm... using email addresses as usernames seems to break the admin users function really badly (can't generate route for member_path errors...)  ... the periods in the domain part seem to break the route generation.  Anyone else seen this..?

Last edited by dhmspector (2009-05-14 12:06:27)

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

In working with this tutorial code, it seems that it's superfluous to require a user to activate via email when they register with the app using OpenID. Does anyone else have thoughts about that? Consider this:

* User comes to site and clicks login with OpenID.
* User is redirected to their OpenID provider.
* User logs into OpenID provider.
* User is returned to our site but there is no existing user with that OpenID URL, so we prompt the user for more information.
* User submits the additional information.

At this point, since the user has authenticated with their OpenID provider, I would consider them as activated. What do you think? As a user would you want the extra step of activating by email or would it seem like a hassle to you? I'm considering some changes to the openid_user model to handle this without sending activation emails for OpenID authenticated users.

Last edited by jxpx777 (2009-05-14 12:03:12)

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

trying to actually use the OpenID features, from a straight out of the box config I get an error from the middle of the open_id_authentication plugin:

undefined local variable or method `fields' for #<SessionsController:0x4282874>
which comes down this line:
/vendor/plugins/open_id_authentication/lib/open_id_authentication.rb:218:in `open_id_redirect_url'

Anyone else seen this error..?

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

I had this problem. I can't recall exactly, but it's either the open_id_authentication plugin is out of date or the updated version no longer uses the fields attribute.

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

it shouldn't be the plugin itself.. I just pulled a naked copy of the whole restful_auth_tutoral from github.  Initing its modules pulls down activefx's form of the plugin from his repo...    fired it up:   same result...

Last edited by dhmspector (2009-05-29 21:06:22)

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Then, that would leave that it no longer uses fields like SessionsController is trying to do. I forget how I fixed it and don't have time to check again, but have a look at it from both sides to make them match up.

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

I think I figured it out -the plugin used "fields" but the data  it wants seems to be in fact the "params" array... changing "fields" to 'params' seems to fix it up.  Seems like such a big problem (and such  trivial fix) that I am surprised that  no one else has reported it, and doubly surprised that its broken in activefx's version of the plugin up on github...

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Id like to go through this tutorial. Should I just install the plugin, and go through the original on page 13 or w/e? Or should I perhaps just install the source code with Git and look over it. Thanks for your advice.

Re: Restful Authentication with all the bells and whistles (new 9/05/08)

Best way to learn is to dive into the code. `git clone` and have at it. Be sure to check this thread for known issues before posting questions. smile