Class: Adamantite::GUI::Request::AddPasswordRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/gui/request/add_password_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master_password, master_password_salt) ⇒ AddPasswordRequest

Returns a new instance of AddPasswordRequest.



9
10
11
12
13
# File 'lib/gui/request/add_password_request.rb', line 9

def initialize(master_password, master_password_salt)
  @master_password = master_password
  @master_password_salt = master_password_salt
  @password_saved = false
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/gui/request/add_password_request.rb', line 7

def password
  @password
end

#password_confirmationObject

Returns the value of attribute password_confirmation.



7
8
9
# File 'lib/gui/request/add_password_request.rb', line 7

def password_confirmation
  @password_confirmation
end

#password_savedObject

Returns the value of attribute password_saved.



7
8
9
# File 'lib/gui/request/add_password_request.rb', line 7

def password_saved
  @password_saved
end

#usernameObject

Returns the value of attribute username.



7
8
9
# File 'lib/gui/request/add_password_request.rb', line 7

def username
  @username
end

#website_titleObject

Returns the value of attribute website_title.



7
8
9
# File 'lib/gui/request/add_password_request.rb', line 7

def website_title
  @website_title
end

Instance Method Details

#confirm_and_add_password!Object



15
16
17
18
19
20
21
# File 'lib/gui/request/add_password_request.rb', line 15

def confirm_and_add_password!
  return unless @password == @password_confirmation

  @password_saved = true
  pw_info_for_file = make_pw_info(@username, @password, @master_password, @master_password_salt)
  write_pw_to_file(@website_title, **pw_info_for_file)
end