It feels like I’m never going to stop writing about restful_authentication. This post is a combination of the previous two (here and here)with the addition of openid. I won’t display any code snippets this time, but just discuss what to expect from the demo app.

First of all, I wanted to add openid support this time around. The railscast is very helpful, but openid has changed to version 2 since then. After looking around, I started my app with this. Since it doesn’t use the acts_as_stateful plugin, I added support for that into the app.

One thing that is not complete, is what happens with the first user. Currently, the first user to sign up will have the role of subscriber, but there are also moderator and administrator roles. I have just been manually editing the db to change the role to administrator. I have looked at a few different ways of accomplishing changing the initial user to an administrator, but have not decided which way I like best and as such, not added that ability just yet. When you are an administrator, you can edit users roles and states through the admin section of the site.

There are a few things to keep in mind about user registration. Users who sign up without an openid, will still sign in initially, but once they sign out, they will have to confirm their account with the activation code that was sent to them. Openid users do not have to activate. Once they sign up, they are active users.

As far as passwords go, users can reset their password if they forget it, and change it when they are logged in. I did not put the code for changing passwords in a settings controller as I did previously, but kept the typical restful form of /users/:id/edit.

There is an administrator section along with the public site. I based the design of the site on this simpla theme and the admin section on this glazed theme. I found this great article and changed all the buttons to look similarly. Unfortunately, it does not use the standard submit_tag. The forms for the site are all styled after uni-forms. Although, not all the color and styling is applied. Overall, it gives the basic site a nice clean look. I might have got carried away with the visuals though, since they are most likely going to change for each person, but for now, it makes it look nicer and easier to work with.

I feel like I’m forgetting to mention a few pieces of pertinent information. When and if I do, I’ll update accordingly. Until then, have fun messing around with restful_authentication and openid. Don’t forget, please let me know of any issues you might run into.

Downloads are available at

Update 3-17-08: my_restful3.17 fixed a few small bugs dealing with the reset_password action and the admin/users view.  Thanks for pointing that out Tom. I really need to get svn setup for this….5 minutes later… Damn, just downloaded and tried to setup the app only to fail on the very first step, rake db:migrate. 3.18 removes the add_index :users, [:identity_url] from the users migration and the migration now works

Tags: , ,