Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A Ruby on Rails example application with authentication built from scratch.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 bin
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 lib
Octocat-spinner-32 log
Octocat-spinner-32 public
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENCE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 config.ru
README.md

primal_auth

A Ruby on Rails example application with authentication built from scratch.

Motivation

Full-featured solutions like the Devise engine are often a good choice when authentication is needed. However, I prefer to implement authentication in a Rails app from scratch as I find it much easier to customize than a Rails engine.

Tell me more

The authentication needs covered are:

  • Signing up
  • Confirming sign-up by email
  • Logging in/out (with email and password)
  • Logging in/out with Omniauth
  • Remembering logged in user
  • Resetting password
  • Tracking users (like e.g. last login, last activity, etc.)

The application is inspired by Ryan Bates' excellent railscasts on authentication and the nifty_authentication generator. I made several modifications to the original code base, added other features (Confirmable, Trackable, Omniauthable), wired everything together into a fully functional Ruby on Rails application, and thoroughly tested everything (mainly unit and integration tests with RSpec and Capybara).

It also takes inspiration from Devise.

Installation

Just git clone the application, cd to the root folder and run

bundle

and then

rake db:migrate

rails server -b localhost

The app works ok on Ruby ~> 1.9.2.

Tests

Run the tests with

bundle exec rspec spec

TODO

  • Lockable
  • Timeoutable
  • Account deletion
  • Migrate to Postgres + add indexes

Contributing

In case of any problems with the app, please file an issue here on Github.

If you want to contribute, please fork the project and send me a pull request (tested with RSpec).

Something went wrong with that request. Please try again.