perpetuum mobile
07. 08. 2014. ruby gem

Devise gem

Installation

In Gemfile:

gem 'devise', '3.2.4'

Running the generator:

rails generate devise:install

Generating the model:

rails generate devise User

Migration:

Model (user):

devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable

Changes in initializer devise.rb:

config.mailer_sender = '...'
config.http_authenticatable = true
config.skip_session_storage = [:http_auth, :token_auth]
# if :confirmable
config.allow_unconfirmed_access_for = 2.days

Confirmation token is being stored as a hash: