mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Updating docs and TODO.
This commit is contained in:
parent
28a7f78fba
commit
d26f90f72b
4 changed files with 37 additions and 6 deletions
17
README.rdoc
17
README.rdoc
|
@ -12,6 +12,7 @@ Right now it's composed of four mainly modules:
|
|||
* Authenticable: responsible for encrypting password and validating authenticity of a user while signing in.
|
||||
* Confirmable: responsible for verifying whether an account is already confirmed to sign in, and to send emails with confirmation instructions.
|
||||
* Recoverable: takes care of reseting the user password and send reset instructions.
|
||||
* Rememberable: manages generating and clearing token for remember the user from a saved cookie.
|
||||
* Validatable: creates all needed validations for email and password. It's totally optional, so you're able to to customize validations by yourself.
|
||||
|
||||
== Dependencies
|
||||
|
@ -49,6 +50,15 @@ We're assuming here you want a User model. First of all you have to setup a migr
|
|||
# required for recoverable
|
||||
t.string :reset_password_token
|
||||
|
||||
# required for rememberable
|
||||
t.string :remember_token
|
||||
|
||||
You may also want to add some indexes to improve performance:
|
||||
|
||||
add_index :your_table, :email
|
||||
add_index :your_table, :confirmation_token # for confirmable
|
||||
add_index :your_table, :reset_password_token # for recoverable
|
||||
|
||||
Now let's setup a User model adding the devise line to have your authentication working:
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
|
@ -66,8 +76,11 @@ This line adds devise authenticable automatically for you inside your User class
|
|||
# Include authenticable + recoverable
|
||||
devise :recoverable
|
||||
|
||||
# Include authenticable + confirmable + recoverable + validatable
|
||||
devise :confirmable, :recoverable, :validatable
|
||||
# Include authenticable + rememberable modules
|
||||
devise :rememberable
|
||||
|
||||
# Include authenticable + confirmable + recoverable + rememberable + validatable
|
||||
devise :confirmable, :recoverable, :rememberable, :validatable
|
||||
|
||||
# Same as above, include all of them
|
||||
devise :all
|
||||
|
|
4
TODO
4
TODO
|
@ -1,4 +1,4 @@
|
|||
* Add remember me (with customizable time frame)
|
||||
* Add customizable time frame for remember me
|
||||
|
||||
* Create generators
|
||||
* Allow stretches and pepper per model
|
||||
|
@ -32,3 +32,5 @@
|
|||
* Add confirmation_sent_at for confirmable
|
||||
* Add confirmable filters
|
||||
* Sign user in automatically after confirming or changing it's password
|
||||
|
||||
* Add remember me
|
||||
|
|
|
@ -13,11 +13,14 @@ module Devise
|
|||
# # include authenticable + recoverable modules
|
||||
# devise :recoverable
|
||||
#
|
||||
# # include authenticable + rememberable modules
|
||||
# devise :rememberable
|
||||
#
|
||||
# # include authenticable + validatable modules
|
||||
# devise :validatable
|
||||
#
|
||||
# # include authenticable + confirmable + recoverable + validatable
|
||||
# devise :confirmable, :recoverable, :validatable
|
||||
# # include authenticable + confirmable + recoverable + rememberable + validatable
|
||||
# devise :confirmable, :recoverable, :rememberable, :validatable
|
||||
#
|
||||
# # shortcut to include all modules (same as above)
|
||||
# devise :all
|
||||
|
|
|
@ -3,7 +3,20 @@ require 'digest/sha1'
|
|||
module Devise
|
||||
module Models
|
||||
|
||||
# Rememberable Module
|
||||
# Rememberable manages generating and clearing token for remember the user
|
||||
# from a saved cookie. Rememberable also has utility methods for dealing
|
||||
# with serializing the user into the cookie and back from the cookie, trying
|
||||
# to lookup the record based on the saved information.
|
||||
# You probably wouldn't use rememberable methods directly, they are used
|
||||
# mostly internally for handling the remember token.
|
||||
# Examples:
|
||||
#
|
||||
# User.find(1).remember_me! # regenerating the token
|
||||
# User.find(1).forget_me! # clearing the token
|
||||
# # generating info to put into cookies
|
||||
# User.serialize_into_cookie(user)
|
||||
# # lookup the user based on the incoming cookie information
|
||||
# User.serialize_from_cookie(cookie_string)
|
||||
module Rememberable
|
||||
|
||||
def self.included(base)
|
||||
|
|
Loading…
Add table
Reference in a new issue