Repository is archived
No commit activity in last 3 years
No release in over 3 years
A Simple has_secure_password implementation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 3.0.0
~> 4.0.0
 Project Readme

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.