Skip to content
This repository was archived by the owner on Feb 2, 2018. It is now read-only.
This repository was archived by the owner on Feb 2, 2018. It is now read-only.

Question on usage #6

Description

@davesag

Hi, I was wondering if you could answer this for me.

I want to use bcrypt to one-way hash my User passwords.

I've posted a question to StackOverflow regarding this, but figured I'd ask you directly.

Assuming my User is along the lines of your Readme file.

class User
  include Mongoid::Document
  include Mongoid::Encryptor
  field :name
  field :password
  encrypts :password
end

Could I just write a helper method in my webapp as follows?

def login (name, cleartxtpass)
  return User.where(name: name, password: cleartxtpass).first
end

If so is how do I tell it to use bcrypt? and is there any preprocessing I need to do to cleartxtpass

Cheers

Dave

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions