1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

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.
This commit is contained in:
Tom 2021-07-24 23:00:24 -06:00 committed by Ali Mohammad Pur
parent 81c183e06a
commit 1a664d80f9

View file

@ -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);