Skip to content

Instantly share code, notes, and snippets.

@kenrett
Created Jan 5, 2017
Embed
What would you like to do?
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