From 3e57e70d89ac4e53b83d742533e25eec42ff5f08 Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Fri, 18 Jul 2025 12:42:24 +0200 Subject: [PATCH] Make MFA Validation Error dialog link to MFA user settings Summary: Allow users to click once to get to their MFA Settings when getting an error that they do not have Multi-Factor Auth set up for their account, instead of letting them perform four clicks. The higher the threshold of required user interaction, the less likely I'm going to try. Me lazy. Closes T16175 Test Plan: * Make sure not to have MFA enabled on your user account in http://phorge.localhost/settings/panel/multifactor/ * Go to http://phorge.localhost/T1 * In the "Add Action..." dropdown, select "Sign With MFA" * Write something in the comment text field * Click the "Submit" button * Check the "Validation Errors" dialog and click a link Reviewers: O1 Blessed Committers, mainframe98 Reviewed By: O1 Blessed Committers, mainframe98 Subscribers: mainframe98, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T16175 Differential Revision: https://we.phorge.it/D26193 --- .../settings/panel/PhabricatorSettingsPanel.php | 15 +++++++++++++++ .../PhabricatorApplicationTransactionEditor.php | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/applications/settings/panel/PhabricatorSettingsPanel.php b/src/applications/settings/panel/PhabricatorSettingsPanel.php index 884572a1e1..483cabdc48 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanel.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanel.php @@ -25,6 +25,9 @@ abstract class PhabricatorSettingsPanel extends Phobject { return $this; } + /** + * @return PhabricatorUser + */ public function getUser() { return $this->user; } @@ -34,6 +37,9 @@ abstract class PhabricatorSettingsPanel extends Phobject { return $this; } + /** + * @return PhabricatorUser + */ public function getViewer() { return $this->viewer; } @@ -48,6 +54,9 @@ abstract class PhabricatorSettingsPanel extends Phobject { return $this; } + /** + * @return PhabricatorController + */ final public function getController() { return $this->controller; } @@ -57,6 +66,9 @@ abstract class PhabricatorSettingsPanel extends Phobject { return $this; } + /** + * @return AphrontSideNavFilterView + */ final public function getNavigation() { return $this->navigation; } @@ -66,6 +78,9 @@ abstract class PhabricatorSettingsPanel extends Phobject { return $this; } + /** + * @return PhabricatorUserPreferences + */ public function getPreferences() { return $this->preferences; } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index 21edc0bc6e..ed407f6fff 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -3208,13 +3208,20 @@ abstract class PhabricatorApplicationTransactionEditor foreach ($xactions as $xaction) { if (!$factors) { + $mfa_panel = id(new PhabricatorMultiFactorSettingsPanel()) + ->setUser($this->getActor()); + $mfa_uri = $mfa_panel->getPanelURI(); + $mfa_panel_name = pht('Settings'); + $mfa_link = new PhutilSafeHTML( + ''.$mfa_panel_name.''); $errors[] = new PhabricatorApplicationTransactionValidationError( $transaction_type, pht('No MFA'), pht( 'You do not have any MFA factors attached to your account, so '. 'you can not sign this transaction group with MFA. Add MFA to '. - 'your account in Settings.'), + 'your account in %s.', + $mfa_link), $xaction); } } -- 2.51.2