Skip to content
Simple api authentication engine using has_secure_password
Ruby JavaScript CSS
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app
config
lib
script
spec
.gitignore
.rspec
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
config.ru
cz_auth.gemspec

README.md

CzAuth

Simple authentication functionality packaged into gem

Usage

rails g cz_auth:install
rails g cz_auth:model <model_name>
rake db:migrate

You can also work with existing models, by adding the following to an existing model

requires_authentication

Details

The generator will generate a model with the following attributes:

  • email
  • password_digest
  • auth_token
  • password_reset_token

It will then place a requires_authentication method at the top of the model. This will trigger has_secure_password, and before filter used to generate an auth_token.

The model will gain the following methods, and can be override at will:

generate_token: This method takes one argument, which is the column that the token will be placed in. By default, this can be auth_token, or password_reset_token

It does not create controllers, or mailers. These are left to the main application to implement.

Something went wrong with that request. Please try again.