Skip to content

Multistep MFA support for CLI - #1156

Open
t-aleksander wants to merge 7 commits into
devfrom
cli-multistep-mfa
Open

t-aleksander wants to merge 7 commits into
devfrom
cli-multistep-mfa

Conversation

@t-aleksander

Copy link
Copy Markdown
Contributor

No description provided.

#[cfg(test)]
mod tests {
use defguard_core::database::models::location::{LocationMfaMode, ServiceLocationMode};
use defguard_core::database::models::location::{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move tests to a separate file

///
/// Pad the step number so all prefixes in a run have the same width.
fn step_badge(index: usize, total: usize) -> String {
format!("[{:>w$}/{total}] ", index + 1, w = total.to_string().len())

@moubctez moubctez Sep 18, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converting to string is much harder than just:

Suggested change
format!("[{:>w$}/{total}] ", index + 1, w = total.to_string().len())
format!("[{:>w$}/{total}] ", index + 1, w = total.ilog10() as usize + 1)

Comment thread src-tauri/client-cli/src/mfa.rs Outdated
}
.ok_or_else(|| {
CliError::Other(
"Proxy did not return a challenge for mobile-approve MFA".into(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Proxy did not return a challenge for mobile-approve MFA".into(),
"Edge did not return a challenge for mobile-approve MFA".into(),

Comment thread src-tauri/client-cli/src/mfa.rs Outdated
eprintln!("Could not open browser. Open this URL manually: {url}");
} else {
eprintln!("Could not open browser. Open the URL above manually.");
eprintln!("{badge}Could not open browser. Open the URL above manually.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
eprintln!("{badge}Could not open browser. Open the URL above manually.");
eprintln!("{badge}Could not open browser. Open the above URL manually.");

.unwrap();
assert!(error_outcome.result.is_err());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move tests to a separate file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants