persistent_cookie_authentication_generator gem

Gem details

This generator creates an authentication system with persistent cookie management.

Features include

* a model which uses SHA1 encryption and salted hashes for passwords
* a controller with signup, login, welcome and logoff actions
* gmail smtp server integration
* account creation that requires account verification via email
* supports forgotten and changed passwords
* a mixin which lets you easily add advanced authentication features to your abstract base controller
* extensive unit and functional test cases to make sure nothing breaks.
* token based authentication
* persistent cookie management that allows anonymous users to be authenticated via cookies

Websitehttp://liangzan.net/?p=34 Author Liang Zan Tags generators, Cookies, Authentication

Documentation

Install the Gem:
gem install persistent_cookie_authentication_generator

From the directory of your Rails app, run this from the shell

ruby script/generate persistent_cookie_authentication



Change your config/database.yml settings. Then update your database by running

rake db:migrate



From app/controllers/application.rb, add this within application.rb

include UserSystem



From config/environment.rb, add this at the end of the file

require 'environments/user_environment'
require 'smtp_tls'



From config/environments/, add this to the end of both development.rb and production.rb

ActionMailer::Base.smtp_settings = {:address => "smtp.gmail.com",
:port => "587",
:domain => "localhost.localdomain",
:authentication => :plain,
:user_name => "yourgmailusername",
:password => "yourgmailpassword"
}



From config/initializers/inflections.rb, modify your inflections.rb to look like this

Inflector.inflections do |inflect|#   inflect.plural /^(ox)$/i, '1en'
#   inflect.singular /^(ox)en/i, '1'
#   inflect.irregular 'person', 'people'
#   inflect.uncountable %w( fish sheep )
inflect.irregular 'LoginCookie', 'LoginCookies'
end



To test, run this from your shell

rake db:test:clone
rake test



From config/user_environment.rb, change the name of your Rails app to your liking

Edit Gem | Back in time (3 older versions) | Last edited by: scott, 3 months ago