At the Forge - Authenticating to a Rails Application
acts_as_authenticated is good enough for many sites as it currently stands. However, there are a number of plugins, suggestions and modifications that you can use with acts_as_authenticated.
For example, many registrations systems want to stop bots from automatically creating user names or e-mail addresses, which can be used to send spam. Thus, it's common for the registration system to ask that users confirm their membership requests via e-mail. So, you enter your information at the site and receive a message that asks you to click on a link. Only after clicking on that link is your account actually activated.
This functionality, although not an obvious part of the core acts_as_authenticated plugin, comes with it and is easy to use. Basically, we use the other generator that comes with acts_as_authenticated. This creates the templates and most of the logic that we need for people to confirm their login status.
There are a wide variety of other things you can do with acts_as_authenticated. For example, you can set it so that passwords are encrypted, but in a way such that it would be reversible. Another common task is to let users change their personal information, such as e-mail addresses and telephone numbers.
This whole discussion of acts_as_authenticated began because I wanted to use OpenID in a Rails application. However, I also wanted to integrate OpenID with an existing authentication mechanism, which brought me to acts_as_authenticated. Now that we have a working, if bare-bones, authentication system on our Web site, we can move on to the next step.
Even if you are not using acts_as_authenticated in your Rails application, it's useful to see how plugins work, how you interact with them and how you can use them to build your Rails application out of parts that have been contributed by other programmers.
Next month, we will look at how we can integrate OpenID into our login system—namely, allowing people to log in using either a user name/password combination or OpenID.
If you're still new to Rails, I strongly recommend The Rails Way by Obie Fernandez. I have found it to be both clear and comprehensive, and one chapter in the book is dedicated to acts_as_authenticated.
There are a number of good resources about acts_as_authenticated on the Web. However, the most comprehensive is the author's Wiki, at technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated.
Reuven M. Lerner, a longtime Web/database developer and consultant, is a PhD candidate in learning sciences at Northwestern University, studying on-line learning communities. He recently returned (with his wife and three children) to their home in Modi'in, Israel, after four years in the Chicago area.
Webinar: 8 Signs You’re Beyond Cron
On Demand NOW
Join Linux Journal and Pat Cameron, Director of Automation Technology at HelpSystems, as they discuss the eight primary advantages of moving beyond cron job scheduling. In this webinar, you’ll learn about integrating cron with an enterprise scheduler.View Now!
|Non-Linux FOSS: All the Bitcoin, None of the Bloat||May 26, 2015|
|Dr Hjkl on the Command Line||May 21, 2015|
|Initializing and Managing Services in Linux: Past, Present and Future||May 20, 2015|
|Goodbye, Pi. Hello, C.H.I.P.||May 18, 2015|
|Using Hiera with Puppet||May 14, 2015|
|Urgent Kernel Patch for Ubuntu||May 12, 2015|
- Initializing and Managing Services in Linux: Past, Present and Future
- Non-Linux FOSS: All the Bitcoin, None of the Bloat
- Dr Hjkl on the Command Line
- Goodbye, Pi. Hello, C.H.I.P.
- Using Hiera with Puppet
- Gartner Dubs DivvyCloud Cool Cloud Management Vendor
- Mumblehard--Let's End Its Five-Year Reign
- Infinite BusyBox with systemd
- Urgent Kernel Patch for Ubuntu
- It's Easier to Ask Forgiveness...