Skip to content

Commit 51cdb2e

Browse files
committed
fix(core): Fix hotmail headless with authenticator
1 parent 554f1d5 commit 51cdb2e

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "check_if_email_exists"
1313
path = "src/main.rs"
1414

1515
[dependencies]
16-
check-if-email-exists = { path = "../core" }
16+
check-if-email-exists = { path = "../core", features = ["headless"] }
1717
clap = { version = "3.2", features = ["derive", "env"] }
1818
env_logger = "0.9"
1919
once_cell = "1.16"

cli/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ pub struct Cli {
6363
#[clap(long, env, default_value = "false", parse(try_from_str))]
6464
pub gmail_use_api: bool,
6565

66+
/// For Hotmail addresses, use a headless browser to connect to the
67+
/// Microsoft account recovery page.
68+
#[clap(long, env)]
69+
pub hotmail_use_headless: Option<String>,
70+
6671
/// For Microsoft 365 email addresses, use OneDrive's API instead of
6772
/// connecting directly to their SMTP servers.
6873
#[clap(long, env, default_value = "false", parse(try_from_str))]
@@ -93,7 +98,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
9398
.set_yahoo_use_api(CONF.yahoo_use_api)
9499
.set_gmail_use_api(CONF.gmail_use_api)
95100
.set_microsoft365_use_api(CONF.microsoft365_use_api)
96-
.set_check_gravatar(CONF.check_gravatar);
101+
.set_check_gravatar(CONF.check_gravatar)
102+
.set_hotmail_use_headless(CONF.hotmail_use_headless.clone());
103+
97104
if let Some(proxy_host) = &CONF.proxy_host {
98105
input.set_proxy(CheckEmailInputProxy {
99106
host: proxy_host.clone(),

core/src/smtp/microsoft/hotmail.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ pub async fn check_password_recovery(
6363
to_email,
6464
);
6565

66-
// Running in a container, I run into the following error:
66+
// Running in a Docker container, I run into the following error:
6767
// Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
6868
// In searching around I found a few different workarounds:
6969
// - Enable namespaces: https://github.com/jessfraz/dockerfiles/issues/65#issuecomment-266532289
@@ -111,7 +111,13 @@ pub async fn check_password_recovery(
111111
.wait()
112112
.for_element(Locator::Id("iSelectProofTitle"))
113113
.and_then(|_| async { Ok(true) });
114-
let is_deliverable = f1.try_race(f2).await?;
114+
// "Enter the code generated by your authenticator app..."
115+
let f3 = c
116+
.wait()
117+
.for_element(Locator::Id("iEnterVerification"))
118+
.and_then(|_| async { Ok(true) });
119+
120+
let is_deliverable = f1.try_race(f2).try_race(f3).await?;
115121

116122
if is_deliverable {
117123
log::debug!(

0 commit comments

Comments
 (0)