Skip to content

jimhj/mongoid_secure_password

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Encrypt password like ActiveRecord has_secure_password method

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages