github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

thoughtbot / clearance

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 772
    • 59
  • Source
  • Commits
  • Network (59)
  • Issues (14)
  • Downloads (27)
  • Wiki (14)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (4)
    • authlogic
    • master ✓
    • rails3
    • send_confirmation_email_in_user_model
  • Tags (27)
    • v0.8.5
    • v0.8.4
    • v0.8.3
    • v0.8.2
    • v0.8.1
    • v0.8.0
    • v0.7.0
    • v0.6.9
    • v0.6.8
    • v0.6.7
    • v0.6.6
    • v0.6.5
    • v0.6.4
    • v0.6.3
    • v0.6.2
    • v0.6.1
    • v0.6.0
    • v0.5.6
    • v0.5.5
    • v0.5.4
    • v0.5.3
    • v0.5.0
    • v0.4.4
    • v0.3.7
    • 0.5.2
    • 0.5.1
    • 0.4.9
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Rails authentication with email & password. — Read more

  cancel

http://thoughtbot.com

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Regenerated gemspec for version 0.8.5 
dancroak (author)
Wed Jan 20 10:21:30 -0800 2010
commit  9aadc84f5a5933161dac93c444581ef455b5bbbb
tree    b08bd3af937412d244e81b04ee56b64685a4ee12
parent  cace2235220e85aa1790e1a72757bc4670bf1023
clearance /
name age
history
message
file .gitignore Tue Jan 19 14:55:48 -0800 2010 generator inserts route text. use jeweler for g... [dancroak]
file CHANGELOG.textile Wed Jan 20 10:10:55 -0800 2010 updating CHANGELOG [dancroak]
file LICENSE Tue Nov 04 08:33:14 -0800 2008 Add license [mike-burns]
file README.textile Wed Jan 20 08:55:48 -0800 2010 added usage section to README [dancroak]
file Rakefile Tue Jan 19 20:07:33 -0800 2010 use Clearance.configure block to set mailer sen... [dancroak]
file VERSION Wed Jan 20 10:11:04 -0800 2010 Version bump to 0.8.5 [dancroak]
directory app/ Tue Jan 19 20:54:28 -0800 2010 use convenience paths (sign_up_path, sign_in_pa... [dancroak]
file clearance.gemspec Wed Jan 20 10:21:30 -0800 2010 Regenerated gemspec for version 0.8.5 [dancroak]
file cucumber.yml Wed Oct 21 07:46:01 -0700 2009 Updated for Cucumber 0.4 [Joe Ferris]
directory generators/ Tue Jan 19 20:54:28 -0800 2010 use convenience paths (sign_up_path, sign_in_pa... [dancroak]
directory lib/ Tue Jan 19 20:54:28 -0800 2010 use convenience paths (sign_up_path, sign_in_pa... [dancroak]
directory rails/ Sat Sep 06 13:51:36 -0700 2008 Added test stuff. [technicalpickles]
directory shoulda_macros/ Tue Jan 19 20:54:28 -0800 2010 use convenience paths (sign_up_path, sign_in_pa... [dancroak]
directory test/ Tue Jan 19 20:07:33 -0800 2010 use Clearance.configure block to set mailer sen... [dancroak]
README.textile

Clearance

Rails authentication with email & password.

We have clearance, Clarence.

Help

  • #thoughtbot IRC channel on freenode
  • documentation
  • mailing list

Bugs, Patches

Fork away and create a Github Issue.

Installation

Clearance is a Rails engine. It works with versions of Rails greater than 2.3.

Install it as a gem however you like to install gems. Gem Bundler example:

gem "clearance"

Make sure the development database exists and run the generator:

script/generate clearance

This:

  • inserts Clearance::User into your User model
  • inserts Clearance::Authentication into your ApplicationController
  • inserts Clearance::Routes.draw(map) into your config.routes.rb
  • created a migration that either creates a users table or adds only missing columns
  • prints further instructions

Usage

If you want to authenticate users for a controller action, use the authenticate method in a before_filter.

class WidgetsController < ApplicationController before_filter :authenticate def index @widgets = Widget.all end end

Subclass and override any Clearance-provided controller as needed:

class SessionsController < Clearance::SessionsController def url_after_create new_blog_post_path end end

Actions that redirect (create, update, and destroy) in Clearance controllers
can be overriden by re-defining url_after_(action) methods as seen above.

Optional Cucumber features

As your app evolves, you want to know that authentication still works. thoughtbot’s opinion is that you should test its integration with your app using Cucumber.

Run the Cucumber generator (if you haven’t already) and Clearance’s feature generator:

script/generate cucumber
script/generate clearance_features

All of the files generated should be new with the exception of the features/support/paths.rb file. If you have not modified your paths.rb then you will be okay to replace it with this one. If you need to keep your paths.rb file then add these locations in your paths.rb manually:

def path_to(page_name)
  case page_name
   ...
  when /the sign up page/i
   new_user_path
  when /the sign in page/i
   new_session_path
  when /the password reset request page/i
   new_password_path
  ...
end

Optional Formtastic views

We have begun standardizing our forms using Formtastic. We highly recommend trying it. It will make your Rails view life more interesting.

Clearance has another generator to generate Formastic views:

script/generate clearance_views

Its implementation is designed so that other view styles can be generated if the community wants it. However, we haven’t needed them so you’ll have to write the patch and send it back if you want other styles (such as Haml).

Authors

Clearance was extracted out of Hoptoad. We merged the authentication code from two of thoughtbot’s clients’ Rails apps and have since used it each time we need authentication. The following people have improved the library. Thank you!

Dan Croak, Mike Burns, Jason Morrison, Joe Ferris, Eugene Bolshakov, Nick Quaranto, Josh Nichols, Mike Breen, Marcel Görner, Bence Nagy, Ben Mabey, Eloy Duran, Tim Pope, Mihai Anca, Mark Cornick, Shay Arnett, Joshua Clayton, Mustafa Ekim, Jon Yurek, Anuj Dutta, and Chad Pytel.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server