Sha256: d6f9d7f82d0a6c001a4e6c6b302c24712446fb9aba3645b8e6a07e0544d16568

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; module Right; module Password; extend Card::Set
# ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/password.rb ~~~~~~~~~~~

include All::Permissions::Accounts

view :editor do |args|
  card.content = ''
  autocomplete = (@parent && @parent.card.name=='*signin+*account') ? 'on' : 'off' #hack
  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, changed: :content,
    when: proc{ |c| !Card::Env[:no_password_encryptions] } do
      # no_password_encryptions = hack for import - fix with api for ignoring events

  salt = (left && left.salt)
  salt = Card::Env[:salt] unless salt.present? # hack - fix with better ORM handling
  self.content = Auth.encrypt content, salt

  #  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

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


# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/right/password.rb ~~~~~~~~~~~
end;end;end;end;

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
card-1.16.15 tmpsets/set/mod007-05_standard/right/password.rb
card-1.16.14 tmpsets/set/mod007-05_standard/right/password.rb
card-1.16.13 tmpsets/set/mod007-05_standard/right/password.rb
card-1.16.12 tmpsets/set/mod007-05_standard/right/password.rb
card-1.16.11 tmpsets/set/mod007-05_standard/right/password.rb
card-1.16.10 tmpsets/set/mod007-05_standard/right/password.rb