Gem plugin‎ > ‎

restful_authentication

Install:
You can add the source of some plugin projects to script/plugin 
  ruby script/plugin --source http://svn.techno-weenie.net/projects/plugins/

then you can install the plugin
  ruby script/plugin install restful_authentication

Generate:
  ruby script/generate authentication user sessions --include-activation

Add to config/routes.rb
  map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate'

and add an observer to config/environment.rb
  config.active_record.observers = :user_observer

Try these for some familliar URLs if you like:
  map.activate '/activate/:activation_code', :controller => 'users',
                                             :action => 'activate', :activation_code => nil
  map.signup '/signup', :controller => 'users', :action => 'new'
  map.login '/login', :controller => 'sessions', :action => 'new'
  map.logout '/logout', :controller => 'sessions', :action => 'destroy'

Edit in model/user_mailer.rb:
  YOURSITE
  ADMINEMAIL

Edit your email settings
Edit environments/development.rb, test.rb, deploy.rb with email settings:
  # Email settings
  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    :tls => true,
    :address => "smtp.mail.com",
    :port => "333",
    :authentication => :plain,
    :user_name => "USERNAME",
    :password => "PASSWORD"  
  }

If you use smtp server with TLS authentication you can use this plugin
  ruby script/plugin install http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls

Then configure the environments/development.rb, test.rb, deploy.rb with email settings:
  # Email settings
  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    :tls => true,
    :address => "smtp.mail.com",
    :port => "333",
    :authentication => :plain,
    :user_name => "USERNAME",
    :password => "PASSWORD"  
  }
Comments