Ver Fonte

Mail: Prompt for password if no password was saved

This allows the user to create a mail configuration without having
to save the password in clear text (or any other form) to disk.
Tom há 4 anos atrás
pai
commit
1a664d80f9
1 ficheiros alterados com 4 adições e 3 exclusões
  1. 4 3
      Userland/Applications/Mail/MailWidget.cpp

+ 4 - 3
Userland/Applications/Mail/MailWidget.cpp

@@ -11,6 +11,7 @@
 #include <LibDesktop/Launcher.h>
 #include <LibGUI/Action.h>
 #include <LibGUI/Clipboard.h>
+#include <LibGUI/InputBox.h>
 #include <LibGUI/Menu.h>
 #include <LibGUI/MessageBox.h>
 #include <LibGUI/Statusbar.h>
@@ -118,9 +119,9 @@ bool MailWidget::connect_and_login()
     }
 
     auto password = config->read_entry("User", "Password", {});
-    if (password.is_empty()) {
-        GUI::MessageBox::show_error(window(), "Mail has no password configured. Refer to the Mail(1) man page for more information.");
-        return false;
+    while (password.is_empty()) {
+        if (GUI::InputBox::show(window(), password, String::formatted("Enter password for {}:", username), "Login", {}, GUI::InputType::Password) != GUI::InputBox::ExecOK)
+            return false;
     }
 
     m_imap_client = make<IMAP::Client>(server, port, tls);