deadbolt

Deadbolt is a plugin for MongoMapper that lets you easily create super simple (and secure) user models.

Usage

Using deadbolt is really easy. Just require it in your gemfile (gem 'deadbolt'). Then write your user model like this:

require ‘bcrypt’

class User include MongoMapper::Document plugin Deadbolt end That’s it!

Usage

Deadbolt assumes that:

  • You want users to confirm their password.

  • Your users are identified by their email address.

It does not assume that you want to validate the uniqueness of each user’s email address. If do you want to, simply add the line validates_uniqueness_of :email to your model. You can add whatever other keys and validations you want to your model.

To check that a user successfully logged in, use User.authenticate(email, password). Assuming that the email and password match up, this will return the full user object, including any custom data you’ve defined. If the email and password do not match up, it will return nil.

Contributing

  1. Fork the project.

  2. Make whatever changes you plan on making.

  3. Submit a pull request that accurately describes what you’ve added or changed and why. NOTE: This does not mean to say how you did it. I can read the code.

Credits

Written by J-P Teti. Special thanks to John Nunemaker for creating MongoMapper and to everyone who has contributed to that project.

License

Licensed under the MIT License, which is found in the file LICENSE. In short: do whatever you feel like with this code.