Sha256: 98b672872da398ae1d5e47ef75217bb5b51bfe6d9b94e289b6e910b89f89fa64

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

# dm-is-authenticatable

* [Source](http://github.com/postmodern/dm-is-authenticatable)
* [Issues](http://github.com/postmodern/dm-is-authenticatable/issues)
* [Documentation](http://rubydoc.info/gems/dm-is-authenticatable/frames)
* [Email](mailto:postmodern.mod3 at gmail.com)

## Description

A DataMapper plugin for adding authentication and encrypted passwords to
your DataMapper models. Ideal for use with
[warden](http://github.com/hassox/warden) or
[sinatra_warden](http://github.com/jsmestad/sinatra_warden).

## Example

    require 'dm-core'
    require 'dm-is-authenticatable'
  
    class User
  
      include DataMapper::Resource

      is :authenticatable
    
      # Name of the Licence
      property :name, String
    
    end
  
    user = User.new(:name => 'bob')
    user.password = 'secret'
    # => "secret"

Validates confirmation of the password:

    user.valid?
    # => false

    user.password_confirmation = 'secret'
    # => "secret"

    user.valid?
    # => true

Uses BCryptHash by default:

    user.encrypted_password
    # => "$2a$10$kC./7/ClA7mJwqqWhO02hu7//ybbsn7QKi4p5PZN0R1.XeQ/oYBAC"

Handles finding and authenticating resources in the database:

    user.save
    # => true

    User.authenticate(:name => 'bob', :password => 'secret')
    # => #<User: ...>

## Requirements

* [bcrypt-ruby](http://rubygems.org/gems/bcrypt-ruby) ~> 2.1
* [dm-core](http://github.com/datamapper/dm-core/) ~> 1.0
* [dm-types](http://github.com/datamapper/dm-types/) ~> 1.0
* [dm-validations](http://github.com/datamapper/dm-validations/) ~> 1.0

## Install

    $ gem install dm-is-authenticatable

## License

Copyright (c) 2010-2011 Hal Brodigan

See {file:LICENSE.txt} for license information.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-is-authenticatable-0.1.1 README.md