Module: Watobo::Gui::MasterPW

Defined in:
lib/watobo/gui/utils/master_password.rb

Class Method Summary collapse

Class Method Details

.disableObject


42
43
44
45
# File 'lib/watobo/gui/utils/master_password.rb', line 42

def self.disable
  @save_without_master = false
  @master_password = ''
end

.enableObject


47
48
49
# File 'lib/watobo/gui/utils/master_password.rb', line 47

def self.enable
  @save_without_master = true
end

.enabled?Boolean

check if master password is set

Returns:

  • (Boolean)

73
74
75
# File 'lib/watobo/gui/utils/master_password.rb', line 73

def self.enabled?
  return @master_password.empty?
end

.getObject

retrieve the master password


68
69
70
# File 'lib/watobo/gui/utils/master_password.rb', line 68

def self.get
  @master_password
end

.save_passwords=(state) ⇒ Object


55
56
57
# File 'lib/watobo/gui/utils/master_password.rb', line 55

def self.save_passwords=(state)
  @save_passwords = state
end

.save_passwords?Boolean

Returns:

  • (Boolean)

51
52
53
# File 'lib/watobo/gui/utils/master_password.rb', line 51

def self.save_passwords?
  @save_passwords
end

.save_without_master=(state) ⇒ Object


59
60
61
# File 'lib/watobo/gui/utils/master_password.rb', line 59

def self.save_without_master=(state)
  @save_without_master = state
end

.save_without_master?Boolean

Returns:

  • (Boolean)

63
64
65
# File 'lib/watobo/gui/utils/master_password.rb', line 63

def self.save_without_master?
  @save_without_master
end

.set=(pw) ⇒ Object

set the master password


30
31
32
33
34
35
# File 'lib/watobo/gui/utils/master_password.rb', line 30

def self.set=(pw)
  @master_password = ''
  return false unless pw.is_a? String
  @master_password = pw
  true
end

.set?Boolean

Returns:

  • (Boolean)

37
38
39
40
# File 'lib/watobo/gui/utils/master_password.rb', line 37

def self.set?
  return false unless @master_password.is_a? String
  @master_password.empty?
end

.settingsObject


77
78
79
# File 'lib/watobo/gui/utils/master_password.rb', line 77

def self.settings
  s = { :save_passwords => @save_passwords, :save_without_master => @save_without_master }
end

.settings=(s) ⇒ Object


81
82
83
84
85
86
# File 'lib/watobo/gui/utils/master_password.rb', line 81

def self.settings=(s)
  return false unless s.is_a? Hash
  @save_passwords = s[:save_passwords] if s.has_key? :save_passwords
  @save_without_master = s[:save_without_master] if s.has_key? :save_without_master
  true
end