Skip to content

Instantly share code, notes, and snippets.

@kenrett
Created January 5, 2017 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenrett/d7209b691666cd1a89118c9853da35ac to your computer and use it in GitHub Desktop.
Save kenrett/d7209b691666cd1a89118c9853da35ac to your computer and use it in GitHub Desktop.
module MCrypt
class Password
def initialize(hashed_password)
@hash = hashed_password
end
def self.create(plain_text_password)
plain_text_password
.reverse
.split(//) * "*"
end
end
end
# require_relative './mcrypt'
class User < ActiveRecord::Base
# attr_writer :password
include BCrypt
# include MCrypt
def password
@password ||= Password.new(password_hash)
p @password
end
def password=(new_password)
@password = Password.create(new_password)
self.password_hash = @password
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment