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.



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

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.



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

def password
  @password
end

#password_confirmationObject

Returns the value of attribute password_confirmation.



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

def password_confirmation
  @password_confirmation
end

#password_savedObject

Returns the value of attribute password_saved.



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

def password_saved
  @password_saved
end

#usernameObject

Returns the value of attribute username.



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

def username
  @username
end

#website_titleObject

Returns the value of attribute website_title.



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

def website_title
  @website_title
end

Instance Method Details

#confirm_and_add_password!Object



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

def confirm_and_add_password!
  if @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
end