From 1a664d80f97ff4b69a9f8ad84f5367cd9edb6964 Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 24 Jul 2021 23:00:24 -0600 Subject: [PATCH] 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. --- Userland/Applications/Mail/MailWidget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index a7557c4c8c..e830a15695 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -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(server, port, tls);