Sinatra-Authlogic-Template icon indicating copy to clipboard operation
Sinatra-Authlogic-Template copied to clipboard

An Authentication Solution for Sinatra

Warning: Not really tested in production yet.

This is a template for a Sinatra app that gets Authlogic (version 2.1.3+) working for authentication. To use it, make sure that you have the required dependencies (Sinatra and Authlogic are vendored):

gem install haml activerecord activesupport sqlite3-ruby pony

Then clone this repository:

git clone git://github.com/ehsanul/Sinatra-Authlogic-Template.git

Edit the db/config.yml file and specify adapter settings. It defaults to sqlite3. You have to then run rake to create the database and run migrations. The command is simply:

rake

For subsequent migrations, run:

rake migrate

If you have sqlite3 installed and sendmail, or smtp on localhost for the email activation, the app should work out of the box. Run it with:

ruby sin-auth-template.rb

Or run it in production using passenger, or just:

rackup

Pony can be configured to use other SMTP settings. Just take a look at the User instance methods and adjust as required. Should probably switch to the Mail library. This is just something to get you started, so it doesn't matter all that much anyways.

Contributions:

Alf Mikulah - Authlogic 2.1.3 compatibility

Todo:

Tests