Multistep MFA support for CLI - #1156
Open
t-aleksander wants to merge 7 commits into
Open
t-aleksander wants to merge 7 commits into
t-aleksander wants to merge 7 commits into
Conversation
moubctez
reviewed
Sep 18, 2026
| #[cfg(test)] | ||
| mod tests { | ||
| use defguard_core::database::models::location::{LocationMfaMode, ServiceLocationMode}; | ||
| use defguard_core::database::models::location::{ |
Contributor
There was a problem hiding this comment.
Move tests to a separate file
moubctez
reviewed
Sep 18, 2026
| /// | ||
| /// 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()) |
Contributor
There was a problem hiding this comment.
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) |
moubctez
reviewed
Sep 18, 2026
| } | ||
| .ok_or_else(|| { | ||
| CliError::Other( | ||
| "Proxy did not return a challenge for mobile-approve MFA".into(), |
Contributor
There was a problem hiding this comment.
Suggested change
| "Proxy did not return a challenge for mobile-approve MFA".into(), | |
| "Edge did not return a challenge for mobile-approve MFA".into(), |
moubctez
reviewed
Sep 18, 2026
| 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."); |
Contributor
There was a problem hiding this comment.
Suggested change
| eprintln!("{badge}Could not open browser. Open the URL above manually."); | |
| eprintln!("{badge}Could not open browser. Open the above URL manually."); |
moubctez
reviewed
Sep 18, 2026
| .unwrap(); | ||
| assert!(error_outcome.result.is_err()); | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
Move tests to a separate file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.