Sha256: 060326fe9a8b05e24730a356bd56ae2bf29481ecdfb9b897f80fd553025d54be

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

include All::Permissions::Accounts

view :editor do |args|
  card.content = ''
  autocomplete = (@parent && @parent.card.name=='*signin+*account') ? 'on' : 'off' #hack
  form.password_field :content, :class=>'card-content', :autocomplete=>autocomplete
end

view :raw do |args|
  '<em>encrypted</em>'
end

event :encrypt_password, :on=>:save, :after=>:process_subcards do
  salt = (left && left.salt)
  unless salt.present? or salt = Card::Env[:salt] # hack - fix with better ORM handling
    #errors.add :password, 'need a valid salt'
    # turns out we have a lot of existing account without a salt.  not sure when that broke??
  end
  if db_content_changed?
    unless Card::Env[:no_password_encryptions] # hack for import - fix with api for ignoring events
      self.content = Auth.encrypt content, salt
    end
  end
end

event :validate_password, :on=>:save, :before=>:approve do
  unless content.length > 3
    errors.add :password, 'must be at least 4 characters'
  end
end

event :validate_password_present, :on=>:update, :before=>:approve do
  abort :success if content.blank?
end

def ok_to_read
  is_own_account? ? true : super
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wagn-1.14.9 mod/05_standard/set/right/password.rb
wagn-1.14.8 mod/05_standard/set/right/password.rb
wagn-1.14.7 mod/05_standard/set/right/password.rb
wagn-1.14.6 mod/05_standard/set/right/password.rb
wagn-1.14.5 mod/05_standard/set/right/password.rb
wagn-1.14.4 mod/05_standard/set/right/password.rb
wagn-1.14.3 mod/05_standard/set/right/password.rb
wagn-1.14.2 mod/05_standard/set/right/password.rb
wagn-1.14.1 mod/05_standard/set/right/password.rb
wagn-1.14.0 mod/05_standard/set/right/password.rb
wagn-1.14.0.pre3 mod/05_standard/set/right/password.rb
wagn-1.14.0.pre2 mod/05_standard/set/right/password.rb
wagn-1.14.0.pre1 mod/05_standard/set/right/password.rb