Making a demo login with restful_authentication

In order for someone to give The Project (Min Packning) a try it was required to register an account and provide a valid e-mail address. This is an obstacle, so I wanted to add a way for people to try the service without registering. It was actually very easy. I created a demo user account, added a demo method to SessionsController and added suitable routing. Now visiting www.minpackning.se/demo will give a logged in session as the demo user.

In app/controllers/sessions_controller.rb:

  def demo
    params[:login] = 'demologin'
    params[:password] = 'demopassword'
    create
  end

In config/routes.rb:

  map.demo '/demo', :controller => 'sessions', :action => 'demo'

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.