Module: Lich::Common::GUI::MasterPasswordPrompt Private
- Defined in:
- documented/common/gui/master_password_prompt.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
-
.show_create_master_password_dialog ⇒ String?
private
Shows a dialog for the user to create a master password.
-
.show_enter_master_password_dialog(validation_test = nil) ⇒ String?
private
Shows a dialog for the user to enter a master password for recovery.
-
.show_warning_dialog(title, message) ⇒ Boolean
private
Displays a warning dialog to the user and waits for a response.
-
.validate_master_password(master_password, validation_test) ⇒ Boolean
private
Validates the provided master password against a validation test.
Class Method Details
.show_create_master_password_dialog ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Shows a dialog for the user to create a master password.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'documented/common/gui/master_password_prompt.rb', line 14 def self.show_create_master_password_dialog # Show UI dialog to user master_password = MasterPasswordPromptUI.show_dialog return nil if master_password.nil? # ==================================================================== # VALIDATION: Check password requirements # ==================================================================== if master_password.length < 8 if show_warning_dialog( "Short Password", "Password is shorter than 8 characters.\n" + "Longer passwords (12+ chars) are stronger.\n\n" + "Continue with this password?" ) # User chose to continue with weak password Lich.log "info: Master password strength validated (user override)" return master_password else # User declined weak password, restart Lich.log "info: User rejected weak password, prompting again" return show_create_master_password_dialog end end Lich.log "info: Master password strength validated" master_password end |
.show_enter_master_password_dialog(validation_test = nil) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Shows a dialog for the user to enter a master password for recovery. Clearly indicates password recovery vs creation.
52 53 54 55 56 57 58 59 60 61 62 |
# File 'documented/common/gui/master_password_prompt.rb', line 52 def self.show_enter_master_password_dialog(validation_test = nil) # Show recovery UI dialog to user # Clearly indicates password recovery vs creation result = MasterPasswordPromptUI.show_recovery_dialog(validation_test) return nil if result.nil? Lich.log "info: Master password entered and validated for recovery" result end |
.show_warning_dialog(title, message) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Displays a warning dialog to the user and waits for a response.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'documented/common/gui/master_password_prompt.rb', line 84 def self.show_warning_dialog(title, ) # Block until dialog completes response = nil mutex = Mutex.new condition = ConditionVariable.new Gtk.queue do dialog = Gtk::MessageDialog.new( parent: nil, flags: :modal, type: :warning, buttons: :yes_no, message: title ) dialog.secondary_text = response = dialog.run dialog.destroy # Signal waiting thread mutex.synchronize { condition.signal } end # Wait for dialog to complete mutex.synchronize { condition.wait(mutex) } response == Gtk::ResponseType::YES end |
.validate_master_password(master_password, validation_test) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Validates the provided master password against a validation test.
71 72 73 74 75 |
# File 'documented/common/gui/master_password_prompt.rb', line 71 def self.validate_master_password(master_password, validation_test) return false if master_password.nil? || validation_test.nil? MasterPasswordManager.validate_master_password(master_password, validation_test) end |