Home

gundestrup edited this page Sep 13, 2010 · 19 revisions

Welcome to the acts_as_authenticated wiki!
The following has been taken directory from the web archive.org

Please note that acts_as_authenticated, is no longer activlyed developed/maintained.
AAA was created by: technoweenie
AAA was salved by: gundestrup, for future referance/development

Everybody is welcome to pitch in, and update/expand/improce AAA, so please send me a mail, and I will give you write access.

Onwards!

In rails/:

ruby script/plugin install git://github.com/gundestrup/acts_as_authenticated.git

ruby script/generate authenticated user account

This step will also generate the required migration for the user table: In rails/app:

rake db:migrate

Read through controllers/account_controller , models/user.rb and lib/authenticated_system.rb

Put include AuthenticatedSystem in your application controller (make sure you put it in the class, not before it), and put before_filter :login_required in every controller you want protected. More details in account_controller.rb.

To get to user info inside a controller or view (like, say, their login name):

current_user.login

To create a user account, go to http://localhost:3000/account/signup (or wherever your server is accessible)

You can get additonal help at http://github.com/gundestrup/acts_as_authenticated/wikis wiki.

Some remarks

This almost worked instantly for me! I’m impressed. However, I did have to change line 11 of authenticated_system.rb to include User.find(session[:user])) instead of User.find_by_id(session[:user])), because Ruby wouldn’t recognize that function. Dunno why, I thought I had seen it before…

Also, I think this package could be even better if it included an “edit account” template.

Careful, User.find and User.findby_id are subtly different. find_by_id would return nil if it can’t find the user. find would raise an exception._
h1. Tags

Tag 1.0

I have created a tag 1.0 to mark the original version.
The only difference is the readme file.

Tag 2.0

I have created a tag 2.0
Here the generator creates html.erb files.
Now it time to make sure it works with Rails 2

Tag 3.0 ?

Here I hope to integrade some of the features you can expand AAA with, to be build in options.