No commit activity in last 3 years
No release in over 3 years
Encrypt password like ActiveRecord has_secure_password method.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 3.0.0
~> 3.0.0
 Project Readme

MongoidSecurePassword

MongoidSecurePassword acts like ActiveRecord has_secure_password.
It's used to encrypt password with bcrypt.

Installation

Add this line to your application's Gemfile:

gem 'mongoid_secure_password', :git => "git://github.com/jimhj/mongoid_secure_password.git"

And then execute:

$ bundle install

Usage

  class User
    include Mongoid::Document
    include Mongoid::SecurePassword
  end

  user = User.new
  user.name = params[:name]
  user.password = params[:password]
  user.password_confirmation = params[:password_confirmation]
  user.save

OR

  user = User.find_by(:login => params[:login])
  if user.password == params[:password]
    # do someting. 
  end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request