class Ezframe::PasswordType

Public Class Methods

new(attr = nil) click to toggle source
Calls superclass method Ezframe::TypeBase::new
# File lib/ezframe/column_type.rb, line 285
def initialize(attr = nil)
  super(attr)
  @attribute[:no_view] = true
end

Public Instance Methods

db_value() click to toggle source
# File lib/ezframe/column_type.rb, line 310
def db_value
  crypt = BCrypt::Password.create(@value)
  return crypt.to_s
end
encrypt_value(val) click to toggle source
# File lib/ezframe/column_type.rb, line 290
def encrypt_value(val)
  crypt = BCrypt::Password.create(val)
  return crypt.to_s
end
form(opts = {}) click to toggle source
# File lib/ezframe/column_type.rb, line 300
def form(opts = {})
  return nil if no_edit? && !opts[:force]
  key = self.key
  key ="#{key}#{opts[:key_suffix]}" if opts[:key_suffix]
  h = Ht.input(type: "password", name: key, label: @attribute[:label], value: "")
  h[:class] = @attribute[:class] if @attribute[:class]
  h[:after] = make_error_box(key)
  return  h
end
value_equal?(value_from_db, new_value) click to toggle source
# File lib/ezframe/column_type.rb, line 295
def value_equal?(value_from_db, new_value)
  crypt = BCrypt::Password.new(value_from_db)
  return crypt == new_value
end