diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -1279,14 +1279,41 @@ $fields = $this->willBuildEditForm($object, $fields); + $request_path = $request->getRequestURI() + ->setQueryParams(array()); + $form = id(new AphrontFormView()) ->setUser($viewer) + ->setAction($request_path) ->addHiddenInput('editEngine', 'true'); foreach ($this->contextParameters as $param) { $form->addHiddenInput($param, $request->getStr($param)); } + $requires_mfa = false; + if ($object instanceof PhabricatorEditEngineMFAInterface) { + $mfa_engine = PhabricatorEditEngineMFAEngine::newEngineForObject($object) + ->setViewer($viewer); + $requires_mfa = $mfa_engine->shouldRequireMFA(); + } + + if ($requires_mfa) { + $message = pht( + 'You will be required to provide multi-factor credentials to make '. + 'changes.'); + $form->appendChild( + id(new PHUIInfoView()) + ->setSeverity(PHUIInfoView::SEVERITY_MFA) + ->setErrors(array($message))); + + // TODO: This should also set workflow on the form, so the user doesn't + // lose any form data if they "Cancel". However, Maniphest currently + // overrides "newEditResponse()" if the request is Ajax and returns a + // bag of view data. This can reasonably be cleaned up when workboards + // get their next iteration. + } + foreach ($fields as $field) { if (!$field->getIsFormField()) { continue;