Module: Watobo::Gui::MasterPW

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

Class Method Summary collapse

Class Method Details

.disableObject



21
22
23
24
# File 'lib/watobo/gui/utils/master_password.rb', line 21

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

.enableObject



26
27
28
# File 'lib/watobo/gui/utils/master_password.rb', line 26

def self.enable
  @save_without_master = true
end

.enabled?Boolean

check if master password is set



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

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

.getObject

retrieve the master password



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

def self.get
  @master_password
end

.save_passwords=(state) ⇒ Object



34
35
36
# File 'lib/watobo/gui/utils/master_password.rb', line 34

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

.save_passwords?Boolean



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

def self.save_passwords?
  @save_passwords
end

.save_without_master=(state) ⇒ Object



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

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

.save_without_master?Boolean



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

def self.save_without_master?
  @save_without_master
end

.set=(pw) ⇒ Object

set the master password



9
10
11
12
13
14
# File 'lib/watobo/gui/utils/master_password.rb', line 9

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

.set?Boolean



16
17
18
19
# File 'lib/watobo/gui/utils/master_password.rb', line 16

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

.settingsObject



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

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

.settings=(s) ⇒ Object



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

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