Sequel secure password

BCrypt authentication and password hashing for Sequel models

Download .zip Download .tar.gz View on GitHub

Secure password plugin for Sequel

Plugin adds BCrypt authentication and password hashing to Sequel models. Model using this plugin should have password_digest field.

This plugin was created by extracting has_secure_password strategy from rails.

Installation

Add this line to your application's Gemfile:

gem 'sequel_secure_password'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sequel_secure_password

Example usage

class User < Sequel::Model
  plugin :secure_password
end

user = User.new
user.password = "foo"
user.password_confirmation = "bar"
user.valid? # => false

user.password_confirmation = "foo"
user.valid? # => true

user.authenticate("foo") # => user
user.authenticate("bar") # => nil

For more information please refer to the readme.